home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.89.06.sit / SC.015.Offscreen / Offscreen.inc1.p next >
MacBinary  |  1989-04-01  |  27.5 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert ZX81 Sinclair BASIC (image/sinclairBASIC) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat Apr 1 15:02:48 1989, modified Sat Apr 1 15:02:48 1989, creator 'MPS ', type ASCII, 27480 bytes "Offscreen.inc1.p" , at 0x6bd8 422 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 10 4f 66 66 73 63 72 | 65 65 6e 2e 69 6e 63 31 |..Offscr|een.inc1|
|00000010| 2e 70 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.p......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 6b 58 00 | 00 01 a6 a0 5a db 68 a0 |.....kX.|....Z.h.|
|00000060| 5a db 68 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |Z.h.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 6f f4 00 00 |........|....o...|
|00000080| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |{-------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000000d0| 23 0d 23 09 41 70 70 6c | 65 20 4d 61 63 69 6e 74 |#.#.Appl|e Macint|
|000000e0| 6f 73 68 20 44 65 76 65 | 6c 6f 70 65 72 20 54 65 |osh Deve|loper Te|
|000000f0| 63 68 6e 69 63 61 6c 20 | 53 75 70 70 6f 72 74 0d |chnical |Support.|
|00000100| 23 0d 23 09 22 53 6b 69 | 70 70 79 20 57 68 69 74 |#.#."Ski|ppy Whit|
|00000110| 65 27 73 20 46 61 6d 6f | 75 73 20 48 69 67 68 20 |e's Famo|us High |
|00000120| 4c 65 76 65 6c 20 4f 66 | 66 2d 53 63 72 65 65 6e |Level Of|f-Screen|
|00000130| 20 4d 61 70 20 52 6f 75 | 74 69 6e 65 73 d3 0d 23 | Map Rou|tines..#|
|00000140| 0d 23 09 4f 66 66 73 63 | 72 65 65 6e 2e 69 6e 63 |.#.Offsc|reen.inc|
|00000150| 31 2e 70 09 2d 09 50 61 | 73 63 61 6c 20 53 6f 75 |1.p.-.Pa|scal Sou|
|00000160| 72 63 65 0d 23 0d 23 09 | 43 6f 70 79 72 69 67 68 |rce.#.#.|Copyrigh|
|00000170| 74 20 a9 20 31 39 38 39 | 20 41 70 70 6c 65 20 43 |t . 1989| Apple C|
|00000180| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 23 09 |omputer,| Inc..#.|
|00000190| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|000001a0| 76 65 64 2e 0d 23 09 54 | 68 65 20 63 68 61 72 61 |ved..#.T|he chara|
|000001b0| 63 74 65 72 73 20 64 65 | 70 69 63 74 65 64 20 68 |cters de|picted h|
|000001c0| 65 72 65 69 6e 20 28 65 | 78 63 65 70 74 20 53 6b |erein (e|xcept Sk|
|000001d0| 69 70 70 79 20 57 68 69 | 74 65 29 20 61 72 65 20 |ippy Whi|te) are |
|000001e0| 66 69 63 74 69 74 69 6f | 75 73 2e 0d 23 0d 23 09 |fictitio|us..#.#.|
|000001f0| 56 65 72 73 69 6f 6e 73 | 3a 09 0d 23 09 09 09 09 |Versions|:..#....|
|00000200| 31 2e 30 30 09 09 09 09 | 30 34 2f 38 39 0d 23 0d |1.00....|04/89.#.|
|00000210| 23 09 43 6f 6d 70 6f 6e | 65 6e 74 73 3a 09 0d 23 |#.Compon|ents:..#|
|00000220| 09 09 09 09 4f 66 66 73 | 63 72 65 65 6e 2e 70 09 |....Offs|creen.p.|
|00000230| 09 09 41 70 72 69 6c 20 | 31 2c 20 31 39 38 38 0d |..April |1, 1988.|
|00000240| 23 09 09 09 09 4f 66 66 | 73 63 72 65 65 6e 2e 69 |#....Off|screen.i|
|00000250| 6e 63 31 2e 70 09 41 70 | 72 69 6c 20 31 2c 20 31 |nc1.p.Ap|ril 1, 1|
|00000260| 39 38 38 0d 23 0d 23 09 | 54 68 65 73 65 20 72 6f |988.#.#.|These ro|
|00000270| 75 74 69 6e 65 73 20 70 | 72 6f 76 69 64 65 20 61 |utines p|rovide a|
|00000280| 20 68 69 67 68 2d 6c 65 | 76 65 6c 20 69 6e 74 65 | high-le|vel inte|
|00000290| 72 66 61 63 65 20 74 6f | 20 74 68 65 20 51 75 69 |rface to| the Qui|
|000002a0| 63 6b 44 72 61 77 20 26 | 20 43 6f 6c 6f 72 0d 23 |ckDraw &| Color.#|
|000002b0| 09 4d 61 6e 61 67 65 72 | 20 72 6f 75 74 69 6e 65 |.Manager| routine|
|000002c0| 73 20 77 68 69 63 68 20 | 61 6c 6c 6f 77 20 74 68 |s which |allow th|
|000002d0| 65 20 63 72 65 61 74 69 | 6f 6e 20 61 6e 64 20 6d |e creati|on and m|
|000002e0| 61 6e 69 70 75 6c 61 74 | 69 6f 6e 20 6f 66 20 6f |anipulat|ion of o|
|000002f0| 66 66 2d 73 63 72 65 65 | 6e 0d 23 09 62 69 74 6d |ff-scree|n.#.bitm|
|00000300| 61 70 73 20 61 6e 64 20 | 70 69 78 6d 61 70 73 2e |aps and |pixmaps.|
|00000310| 20 54 68 65 79 20 61 72 | 65 20 64 65 73 69 67 6e | They ar|e design|
|00000320| 65 64 20 74 6f 20 72 75 | 6e 20 6f 6e 20 61 6e 79 |ed to ru|n on any|
|00000330| 20 6d 61 63 68 69 6e 65 | 20 77 69 74 68 20 31 32 | machine| with 12|
|00000340| 38 4b 20 6f 72 0d 23 09 | 6c 61 74 65 72 20 52 4f |8K or.#.|later RO|
|00000350| 4d 73 20 28 73 6f 72 72 | 79 20 36 34 4b 20 52 4f |Ms (sorr|y 64K RO|
|00000360| 4d 20 66 61 6e 73 29 2e | 0d 23 09 4e 6f 74 65 20 |M fans).|.#.Note |
|00000370| 74 68 61 74 20 74 68 65 | 20 64 65 73 69 67 6e 20 |that the| design |
|00000380| 69 6e 63 6f 72 70 6f 72 | 61 74 65 73 20 74 68 65 |incorpor|ates the|
|00000390| 20 69 64 65 61 20 74 68 | 61 74 20 79 6f 75 20 63 | idea th|at you c|
|000003a0| 61 6e 20 67 6f 20 61 6c | 6f 6e 67 20 70 72 65 74 |an go al|ong pret|
|000003b0| 65 6e 64 69 6e 67 0d 23 | 09 74 68 65 72 65 20 69 |ending.#|.there i|
|000003c0| 73 20 61 6e 20 6f 66 66 | 73 63 72 65 65 6e 20 62 |s an off|screen b|
|000003d0| 75 66 66 65 72 20 65 76 | 65 6e 20 77 68 65 6e 20 |uffer ev|en when |
|000003e0| 6f 6e 65 20 63 6f 75 6c | 64 6e d5 74 20 62 65 20 |one coul|dn.t be |
|000003f0| 61 6c 6c 6f 63 61 74 65 | 64 2c 20 61 6e 64 20 74 |allocate|d, and t|
|00000400| 68 65 0d 23 09 63 61 6c | 6c 73 20 77 69 6c 6c 20 |he.#.cal|ls will |
|00000410| 64 6f 20 6e 6f 74 68 69 | 6e 67 2e 0d 23 0d 2d 2d |do nothi|ng..#.--|
|00000420| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000430| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000440| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000450| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000460| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 7d 0d 0d 43 |--------|----}..C|
|00000470| 4f 4e 53 54 0d 09 6e 6f | 44 65 70 74 68 20 3d 20 |ONST..no|Depth = |
|00000480| 2d 32 3b 0d 09 63 68 75 | 6e 6b 79 09 3d 20 30 3b |-2;..chu|nky.= 0;|
|00000490| 0d 0d 54 59 50 45 0d 09 | 50 72 69 76 61 74 65 48 |..TYPE..|PrivateH|
|000004a0| 61 6e 64 6c 65 09 3d 20 | 5e 50 72 69 76 61 74 65 |andle.= |^Private|
|000004b0| 50 74 72 3b 0d 09 50 72 | 69 76 61 74 65 50 74 72 |Ptr;..Pr|ivatePtr|
|000004c0| 09 09 3d 20 5e 50 72 69 | 76 61 74 65 52 65 63 6f |..= ^Pri|vateReco|
|000004d0| 72 64 3b 0d 09 50 72 69 | 76 61 74 65 52 65 63 6f |rd;..Pri|vateReco|
|000004e0| 72 64 09 3d 20 52 45 43 | 4f 52 44 0d 09 09 72 65 |rd.= REC|ORD...re|
|000004f0| 71 75 65 73 74 65 64 42 | 6f 75 6e 64 73 09 3a 20 |questedB|ounds.: |
|00000500| 52 65 63 74 3b 20 7b 62 | 6f 75 6e 64 61 72 79 20 |Rect; {b|oundary |
|00000510| 72 65 63 74 61 6e 67 6c | 65 20 66 6f 72 20 74 68 |rectangl|e for th|
|00000520| 65 20 70 69 78 6d 61 70 | 7d 0d 09 09 7b 75 73 65 |e pixmap|}...{use|
|00000530| 64 20 74 6f 20 64 65 74 | 65 72 6d 69 6e 65 20 74 |d to det|ermine t|
|00000540| 68 65 20 64 65 70 74 68 | 2c 20 73 69 7a 65 2c 20 |he depth|, size, |
|00000550| 61 6e 64 20 64 69 6d 65 | 6e 73 69 6f 6e 73 20 6f |and dime|nsions o|
|00000560| 66 20 74 68 65 20 70 69 | 78 6d 61 70 7d 0d 0d 09 |f the pi|xmap}...|
|00000570| 09 72 65 71 75 65 73 74 | 65 64 44 65 70 74 68 09 |.request|edDepth.|
|00000580| 3a 20 49 4e 54 45 47 45 | 52 3b 20 7b 74 68 65 20 |: INTEGE|R; {the |
|00000590| 72 65 71 75 65 73 74 65 | 64 20 64 65 70 74 68 20 |requeste|d depth |
|000005a0| 6f 66 20 74 68 69 73 20 | 6d 61 70 7d 0d 09 09 7b |of this |map}...{|
|000005b0| 69 66 20 3e 20 30 2c 20 | 61 20 70 72 69 76 61 74 |if > 0, |a privat|
|000005c0| 65 20 64 65 76 69 63 65 | 20 77 69 6c 6c 20 62 65 |e device| will be|
|000005d0| 20 63 72 65 61 74 65 64 | 20 66 6f 72 20 74 68 65 | created| for the|
|000005e0| 20 6d 61 70 7d 0d 0d 09 | 09 72 65 71 75 65 73 74 | map}...|.request|
|000005f0| 65 64 43 6f 6c 6f 72 73 | 09 3a 20 43 54 61 62 48 |edColors|.: CTabH|
|00000600| 61 6e 64 6c 65 3b 20 7b | 63 6f 6c 6f 72 20 74 61 |andle; {|color ta|
|00000610| 62 6c 65 7d 0d 09 09 7b | 6f 75 72 20 6f 77 6e 20 |ble}...{|our own |
|00000620| 63 6f 70 79 20 6f 66 20 | 74 68 65 20 63 6f 6c 6f |copy of |the colo|
|00000630| 72 20 74 61 62 6c 65 20 | 74 68 61 74 20 77 61 73 |r table |that was|
|00000640| 20 70 61 73 73 65 64 20 | 69 6e 7d 0d 0d 09 09 72 | passed |in}....r|
|00000650| 65 71 75 65 73 74 65 64 | 50 6f 6c 69 74 65 09 3a |equested|Polite.:|
|00000660| 20 42 4f 4f 4c 45 41 4e | 3b 20 7b 77 68 65 74 68 | BOOLEAN|; {wheth|
|00000670| 65 72 20 68 65 20 77 61 | 6e 74 65 64 20 69 74 20 |er he wa|nted it |
|00000680| 70 6f 6c 69 74 65 7d 0d | 0d 09 09 62 69 74 73 09 |polite}.|...bits.|
|00000690| 09 09 3a 20 48 61 6e 64 | 6c 65 3b 20 7b 68 61 6e |..: Hand|le; {han|
|000006a0| 64 6c 65 20 74 6f 20 74 | 68 65 20 6f 66 66 2d 73 |dle to t|he off-s|
|000006b0| 63 72 65 65 6e 20 62 69 | 74 73 7d 0d 09 09 7b 69 |creen bi|ts}...{i|
|000006c0| 66 20 4e 49 4c 2c 20 74 | 68 65 72 65 20 69 73 20 |f NIL, t|here is |
|000006d0| 6e 6f 20 70 6f 72 74 20 | 6f 72 20 67 72 61 70 68 |no port |or graph|
|000006e0| 69 63 73 20 64 65 76 69 | 63 65 20 65 69 74 68 65 |ics devi|ce eithe|
|000006f0| 72 7d 0d 09 09 6e 6f 74 | 4f 75 72 73 09 09 09 3a |r}...not|Ours...:|
|00000700| 20 42 4f 4f 4c 45 41 4e | 3b 20 7b 54 52 55 45 20 | BOOLEAN|; {TRUE |
|00000710| 6d 65 61 6e 73 20 74 68 | 61 74 20 77 65 20 64 69 |means th|at we di|
|00000720| 64 6e d5 74 20 63 72 65 | 61 74 65 20 74 68 65 20 |dn.t cre|ate the |
|00000730| 62 69 74 73 7d 0d 09 09 | 6e 65 65 64 73 33 32 42 |bits}...|needs32B|
|00000740| 69 74 73 09 09 3a 20 42 | 4f 4f 4c 45 41 4e 3b 20 |its..: B|OOLEAN; |
|00000750| 7b 79 6f 75 20 6d 75 73 | 74 20 62 65 20 69 6e 20 |{you mus|t be in |
|00000760| 33 32 20 62 69 74 20 6d | 65 6d 6f 72 79 20 6d 6f |32 bit m|emory mo|
|00000770| 64 65 20 74 6f 20 67 65 | 74 20 74 6f 20 62 69 74 |de to ge|t to bit|
|00000780| 73 7d 0d 0d 09 09 62 69 | 74 73 50 6f 72 74 09 09 |s}....bi|tsPort..|
|00000790| 3a 20 43 47 72 61 66 50 | 74 72 3b 20 7b 47 72 61 |: CGrafP|tr; {Gra|
|000007a0| 66 50 6f 72 74 20 75 73 | 65 64 20 66 6f 72 20 74 |fPort us|ed for t|
|000007b0| 68 65 20 6f 66 66 2d 73 | 63 72 65 65 6e 20 6d 61 |he off-s|creen ma|
|000007c0| 70 2e 7d 0d 09 09 62 69 | 74 73 44 65 76 69 63 65 |p.}...bi|tsDevice|
|000007d0| 09 09 3a 20 47 44 48 61 | 6e 64 6c 65 3b 20 7b 47 |..: GDHa|ndle; {G|
|000007e0| 44 65 76 69 63 65 20 61 | 73 73 6f 63 69 61 74 65 |Device a|ssociate|
|000007f0| 64 20 77 69 74 68 20 74 | 68 65 20 6d 61 70 7d 0d |d with t|he map}.|
|00000800| 09 09 7b 70 72 69 76 61 | 74 65 20 64 65 76 69 63 |..{priva|te devic|
|00000810| 65 20 28 69 66 20 72 65 | 71 75 65 73 74 65 64 44 |e (if re|questedD|
|00000820| 65 70 74 68 20 3e 20 30 | 29 7d 0d 09 09 7b 28 66 |epth > 0|)}...{(f|
|00000830| 72 6f 6d 20 74 68 65 20 | 64 65 76 69 63 65 20 6c |rom the |device l|
|00000840| 69 73 74 20 66 6f 72 20 | 72 65 71 75 65 73 74 65 |ist for |requeste|
|00000850| 64 44 65 70 74 68 20 3d | 20 6b 4d 61 78 44 65 70 |dDepth =| kMaxDep|
|00000860| 74 68 29 7d 0d 0d 09 09 | 6f 6c 64 53 65 65 64 09 |th)}....|oldSeed.|
|00000870| 09 09 3a 20 4c 4f 4e 47 | 49 4e 54 3b 20 7b 6f 6c |..: LONG|INT; {ol|
|00000880| 64 20 43 54 53 65 65 64 | 20 66 6f 72 20 74 68 65 |d CTSeed| for the|
|00000890| 20 70 69 78 6d 61 70 27 | 73 20 63 6f 6c 6f 72 20 | pixmap'|s color |
|000008a0| 74 61 62 6c 65 7d 0d 09 | 09 7b 75 73 65 64 20 74 |table}..|.{used t|
|000008b0| 6f 20 64 65 74 65 63 74 | 20 63 6f 6c 6f 72 20 75 |o detect| color u|
|000008c0| 70 64 61 74 65 73 7d 0d | 09 09 0d 09 09 69 6e 76 |pdates}.|.....inv|
|000008d0| 61 6c 52 65 67 69 6f 6e | 09 09 3a 20 52 67 6e 48 |alRegion|..: RgnH|
|000008e0| 61 6e 64 6c 65 3b 20 7b | 70 61 72 74 20 6f 66 20 |andle; {|part of |
|000008f0| 6f 66 66 73 63 72 65 65 | 6e 20 62 75 66 66 65 72 |offscree|n buffer|
|00000900| 20 74 68 61 74 20 69 73 | 20 69 6e 76 61 6c 69 64 | that is| invalid|
|00000910| 7d 0d 0d 09 09 64 72 61 | 77 69 6e 67 50 6f 72 74 |}....dra|wingPort|
|00000920| 09 09 3a 20 47 72 61 66 | 50 74 72 3b 20 7b 73 75 |..: Graf|Ptr; {su|
|00000930| 70 70 6c 69 65 64 20 74 | 6f 20 42 65 67 69 6e 4f |pplied t|o BeginO|
|00000940| 66 66 73 63 72 65 65 6e | 44 61 68 6c 69 6e 67 7d |ffscreen|Dahling}|
|00000950| 0d 09 09 73 61 76 65 64 | 50 6f 72 74 09 09 3a 20 |...saved|Port..: |
|00000960| 47 72 61 66 50 74 72 3b | 20 7b 73 61 76 65 73 20 |GrafPtr;| {saves |
|00000970| 6f 6c 64 20 47 72 61 66 | 50 6f 72 74 20 77 68 69 |old Graf|Port whi|
|00000980| 6c 65 20 64 72 61 77 69 | 6e 67 20 6f 66 66 20 73 |le drawi|ng off s|
|00000990| 63 72 65 65 6e 7d 0d 09 | 09 73 61 76 65 64 4d 61 |creen}..|.savedMa|
|000009a0| 70 09 09 3a 20 42 69 74 | 4d 61 70 3b 20 7b 75 73 |p..: Bit|Map; {us|
|000009b0| 65 64 20 74 6f 20 73 61 | 76 65 20 6d 61 70 20 77 |ed to sa|ve map w|
|000009c0| 68 65 6e 20 77 65 20 64 | 6f 6e d5 74 20 75 73 65 |hen we d|on.t use|
|000009d0| 20 6f 75 72 20 70 6f 72 | 74 7d 0d 09 09 73 61 76 | our por|t}...sav|
|000009e0| 65 64 56 69 73 52 67 6e | 09 09 3a 20 52 67 6e 48 |edVisRgn|..: RgnH|
|000009f0| 61 6e 64 6c 65 3b 20 7b | 73 61 76 65 73 20 74 68 |andle; {|saves th|
|00000a00| 65 20 76 69 73 52 67 6e | 20 66 72 6f 6d 20 61 20 |e visRgn| from a |
|00000a10| 75 73 65 72 2d 73 75 70 | 70 6c 69 65 64 20 70 6f |user-sup|plied po|
|00000a20| 72 74 7d 0d 09 09 73 61 | 76 65 64 44 65 76 69 63 |rt}...sa|vedDevic|
|00000a30| 65 09 09 3a 20 47 44 48 | 61 6e 64 6c 65 3b 20 7b |e..: GDH|andle; {|
|00000a40| 73 61 76 65 73 20 6f 6c | 64 20 47 44 65 76 69 63 |saves ol|d GDevic|
|00000a50| 65 20 77 68 69 6c 65 20 | 64 72 61 77 69 6e 67 20 |e while |drawing |
|00000a60| 6f 66 66 20 73 63 72 65 | 65 6e 7d 0d 09 45 4e 44 |off scre|en}..END|
|00000a70| 3b 20 7b 50 72 69 76 61 | 74 65 52 65 63 6f 72 64 |; {Priva|teRecord|
|00000a80| 7d 0d 0d 0d 0d 56 41 52 | 0d 09 74 68 65 4d 61 63 |}....VAR|..theMac|
|00000a90| 09 3a 20 53 79 73 45 6e | 76 52 65 63 3b 0d 0d 0d |.: SysEn|vRec;...|
|00000aa0| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 20 6c 6f 77 2d |{-------|--- low-|
|00000ab0| 6c 65 76 65 6c 20 73 65 | 72 76 69 63 65 20 72 6f |level se|rvice ro|
|00000ac0| 75 74 69 6e 65 73 20 75 | 73 65 64 20 62 79 20 74 |utines u|sed by t|
|00000ad0| 68 65 20 72 65 73 74 20 | 6f 66 20 4f 66 66 73 63 |he rest |of Offsc|
|00000ae0| 72 65 65 6e 20 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 7d |reen ---|-------}|
|00000af0| 0d 0d 7b 46 69 6c 6c 20 | 6f 75 74 20 74 68 65 20 |..{Fill |out the |
|00000b00| 70 69 78 6d 61 70 20 61 | 63 63 6f 72 64 69 6e 67 |pixmap a|ccording|
|00000b10| 20 74 6f 20 74 68 65 20 | 62 6f 75 6e 64 73 2c 20 | to the |bounds, |
|00000b20| 70 69 78 65 6c 54 79 70 | 65 2c 20 70 69 78 65 6c |pixelTyp|e, pixel|
|00000b30| 53 69 7a 65 2c 20 63 6d | 70 43 6f 75 6e 74 2c 0d |Size, cm|pCount,.|
|00000b40| 20 63 6d 70 53 69 7a 65 | 20 61 6e 64 20 70 6d 54 | cmpSize| and pmT|
|00000b50| 61 62 6c 65 20 70 61 72 | 61 6d 65 74 65 72 73 2e |able par|ameters.|
|00000b60| 20 41 6c 6c 20 66 69 65 | 6c 64 73 20 77 69 6c 6c | All fie|lds will|
|00000b70| 20 62 65 20 6d 6f 64 69 | 66 69 65 64 2e 0d 20 54 | be modi|fied.. T|
|00000b80| 68 65 20 69 6e 69 74 69 | 61 6c 20 70 69 78 6d 61 |he initi|al pixma|
|00000b90| 70 20 77 69 6c 6c 20 62 | 65 20 63 6f 70 69 65 64 |p will b|e copied|
|00000ba0| 20 66 72 6f 6d 20 74 68 | 65 20 63 75 72 72 65 6e | from th|e curren|
|00000bb0| 74 20 47 44 65 76 69 63 | 65 d5 73 20 70 69 78 6d |t GDevic|e.s pixm|
|00000bc0| 61 70 2c 20 73 6f 20 79 | 6f 75 20 6d 75 73 74 20 |ap, so y|ou must |
|00000bd0| 6d 6f 64 69 66 79 0d 20 | 74 68 65 20 70 6d 61 70 |modify. |the pmap|
|00000be0| 5e 5e 2e 62 61 73 65 41 | 64 64 72 20 62 65 66 6f |^^.baseA|ddr befo|
|00000bf0| 72 65 20 75 73 69 6e 67 | 20 69 74 2e 0d 20 64 61 |re using| it.. da|
|00000c00| 74 61 53 69 7a 65 20 77 | 69 6c 6c 20 72 65 74 75 |taSize w|ill retu|
|00000c10| 72 6e 20 77 69 74 68 20 | 74 68 65 20 6e 75 6d 62 |rn with |the numb|
|00000c20| 65 72 20 6f 66 20 62 79 | 74 65 73 20 72 65 71 75 |er of by|tes requ|
|00000c30| 69 72 65 64 20 66 6f 72 | 20 74 68 65 20 70 69 78 |ired for| the pix|
|00000c40| 65 6c 20 64 61 74 61 2e | 0d 20 4e 6f 74 65 3a 20 |el data.|. Note: |
|00000c50| 69 74 20 69 73 20 74 68 | 65 20 72 65 73 70 6f 6e |it is th|e respon|
|00000c60| 73 69 62 69 6c 69 74 79 | 20 6f 66 20 74 68 65 20 |sibility| of the |
|00000c70| 63 61 6c 6c 65 72 20 74 | 6f 20 66 69 6c 6c 20 69 |caller t|o fill i|
|00000c80| 6e 20 74 68 65 20 62 61 | 73 65 41 64 64 72 20 66 |n the ba|seAddr f|
|00000c90| 69 65 6c 64 0d 20 6f 66 | 20 74 68 65 20 70 69 78 |ield. of| the pix|
|00000ca0| 6d 61 70 2e 20 59 6f 75 | 20 6d 61 79 20 77 61 6e |map. You| may wan|
|00000cb0| 74 20 74 6f 20 63 61 6c | 6c 20 4e 65 77 49 6d 70 |t to cal|l NewImp|
|00000cc0| 72 6f 76 65 64 47 42 75 | 66 66 65 72 20 74 6f 20 |rovedGBu|ffer to |
|00000cd0| 73 65 65 20 69 66 20 74 | 68 65 20 73 79 73 74 65 |see if t|he syste|
|00000ce0| 6d 20 77 69 6c 6c 0d 20 | 61 6c 6c 6f 63 61 74 65 |m will. |allocate|
|00000cf0| 20 74 68 65 20 64 61 74 | 61 20 73 70 61 63 65 20 | the dat|a space |
|00000d00| 61 6e 64 20 74 68 65 6e | 20 73 65 74 20 62 61 73 |and then| set bas|
|00000d10| 65 41 64 64 72 20 74 6f | 20 70 6f 69 6e 74 20 74 |eAddr to| point t|
|00000d20| 6f 20 69 74 2e 0d 20 54 | 68 69 73 20 63 61 6c 6c |o it.. T|his call|
|00000d30| 20 63 61 6e 6e 6f 74 20 | 66 61 69 6c 2e 7d 0d 50 | cannot |fail.}.P|
|00000d40| 52 4f 43 45 44 55 52 45 | 20 49 6e 69 74 47 42 75 |ROCEDURE| InitGBu|
|00000d50| 66 66 65 72 50 69 78 6d | 61 70 28 70 6d 61 70 3a |fferPixm|ap(pmap:|
|00000d60| 20 50 69 78 4d 61 70 48 | 61 6e 64 6c 65 3b 20 61 | PixMapH|andle; a|
|00000d70| 42 6f 75 6e 64 73 3a 20 | 52 65 63 74 3b 20 61 50 |Bounds: |Rect; aP|
|00000d80| 69 78 65 6c 54 79 70 65 | 2c 20 61 50 69 78 65 6c |ixelType|, aPixel|
|00000d90| 53 69 7a 65 2c 0d 20 09 | 61 43 6d 70 43 6f 75 6e |Size,. .|aCmpCoun|
|00000da0| 74 2c 20 61 43 6d 70 53 | 69 7a 65 3a 20 49 4e 54 |t, aCmpS|ize: INT|
|00000db0| 45 47 45 52 3b 20 61 50 | 4d 54 61 62 6c 65 3a 20 |EGER; aP|MTable: |
|00000dc0| 43 54 61 62 48 61 6e 64 | 6c 65 3b 20 56 41 52 20 |CTabHand|le; VAR |
|00000dd0| 64 61 74 61 53 69 7a 65 | 3a 20 4c 4f 4e 47 49 4e |dataSize|: LONGIN|
|00000de0| 54 29 3b 0d 09 0d 56 41 | 52 0d 09 74 68 65 47 44 |T);...VA|R..theGD|
|00000df0| 65 76 69 63 65 3a 09 47 | 44 48 61 6e 64 6c 65 3b |evice:.G|DHandle;|
|00000e00| 0d 42 45 47 49 4e 0d 09 | 74 68 65 47 44 65 76 69 |.BEGIN..|theGDevi|
|00000e10| 63 65 20 3a 3d 20 47 65 | 74 47 44 65 76 69 63 65 |ce := Ge|tGDevice|
|00000e20| 3b 09 09 09 09 7b 67 65 | 74 20 74 68 65 20 63 75 |;....{ge|t the cu|
|00000e30| 72 72 65 6e 74 20 64 65 | 76 69 63 65 7d 0d 09 70 |rrent de|vice}..p|
|00000e40| 6d 61 70 5e 5e 3a 3d 74 | 68 65 47 44 65 76 69 63 |map^^:=t|heGDevic|
|00000e50| 65 5e 5e 2e 67 64 50 4d | 61 70 5e 5e 3b 09 09 09 |e^^.gdPM|ap^^;...|
|00000e60| 7b 73 74 61 72 74 20 6f | 75 74 20 77 69 74 68 20 |{start o|ut with |
|00000e70| 64 65 76 69 63 65 d5 73 | 20 70 69 78 6d 61 70 7d |device.s| pixmap}|
|00000e80| 0d 09 57 49 54 48 20 70 | 6d 61 70 5e 5e 20 44 4f |..WITH p|map^^ DO|
|00000e90| 20 42 45 47 49 4e 0d 09 | 09 62 6f 75 6e 64 73 20 | BEGIN..|.bounds |
|00000ea0| 3a 3d 20 61 42 6f 75 6e | 64 73 3b 0d 09 09 70 69 |:= aBoun|ds;...pi|
|00000eb0| 78 65 6c 54 79 70 65 20 | 3a 3d 20 61 50 69 78 65 |xelType |:= aPixe|
|00000ec0| 6c 54 79 70 65 3b 0d 09 | 09 70 69 78 65 6c 53 69 |lType;..|.pixelSi|
|00000ed0| 7a 65 20 3a 3d 20 61 50 | 69 78 65 6c 53 69 7a 65 |ze := aP|ixelSize|
|00000ee0| 3b 0d 20 09 09 63 6d 70 | 43 6f 75 6e 74 20 3a 3d |;. ..cmp|Count :=|
|00000ef0| 20 61 43 6d 70 43 6f 75 | 6e 74 3b 0d 09 09 63 6d | aCmpCou|nt;...cm|
|00000f00| 70 53 69 7a 65 20 3a 3d | 20 61 43 6d 70 53 69 7a |pSize :=| aCmpSiz|
|00000f10| 65 3b 0d 09 09 70 6d 54 | 61 62 6c 65 20 3a 3d 20 |e;...pmT|able := |
|00000f20| 61 50 4d 54 61 62 6c 65 | 3b 0d 09 09 57 49 54 48 |aPMTable|;...WITH|
|00000f30| 20 62 6f 75 6e 64 73 20 | 44 4f 20 42 45 47 49 4e | bounds |DO BEGIN|
|00000f40| 0d 09 09 09 72 6f 77 42 | 79 74 65 73 20 3a 3d 20 |....rowB|ytes := |
|00000f50| 28 28 70 69 78 65 6c 53 | 69 7a 65 20 2a 20 72 69 |((pixelS|ize * ri|
|00000f60| 67 68 74 20 2b 20 31 35 | 29 20 44 49 56 20 31 36 |ght + 15|) DIV 16|
|00000f70| 29 20 2a 20 32 3b 0d 09 | 09 09 7b 63 61 6c 63 75 |) * 2;..|..{calcu|
|00000f80| 6c 61 74 65 20 61 6e 20 | 65 76 65 6e 20 23 20 6f |late an |even # o|
|00000f90| 66 20 77 6f 72 64 73 7d | 0d 09 09 09 64 61 74 61 |f words}|....data|
|00000fa0| 53 69 7a 65 20 3a 3d 20 | 62 6f 74 74 6f 6d 20 2a |Size := |bottom *|
|00000fb0| 20 4c 4f 4e 47 49 4e 54 | 28 72 6f 77 42 79 74 65 | LONGINT|(rowByte|
|00000fc0| 73 29 3b 20 7b 63 61 6c | 63 75 6c 61 74 65 20 74 |s); {cal|culate t|
|00000fd0| 68 65 20 73 69 7a 65 7d | 0d 09 09 09 72 6f 77 42 |he size}|....rowB|
|00000fe0| 79 74 65 73 20 3a 3d 20 | 72 6f 77 42 79 74 65 73 |ytes := |rowBytes|
|00000ff0| 20 2b 20 24 38 30 30 30 | 3b 09 7b 66 6c 61 67 20 | + $8000|;.{flag |
|00001000| 74 68 61 74 20 69 74 d5 | 73 20 61 20 70 69 78 6d |that it.|s a pixm|
|00001010| 61 70 7d 0d 09 09 45 4e | 44 3b 20 7b 57 49 54 48 |ap}...EN|D; {WITH|
|00001020| 7d 0d 09 45 4e 44 3b 20 | 7b 57 49 54 48 7d 0d 45 |}..END; |{WITH}.E|
|00001030| 4e 44 3b 20 7b 49 6e 69 | 74 47 42 75 66 66 65 72 |ND; {Ini|tGBuffer|
|00001040| 50 69 78 6d 61 70 7d 0d | 09 0d 7b 46 69 6c 6c 20 |Pixmap}.|..{Fill |
|00001050| 6f 75 74 20 61 20 70 69 | 78 6d 61 70 20 66 6f 72 |out a pi|xmap for|
|00001060| 20 75 73 65 20 77 69 74 | 68 20 61 6e 20 6f 6e 73 | use wit|h an ons|
|00001070| 63 72 65 65 6e 20 67 72 | 61 66 50 6f 72 74 2e 20 |creen gr|afPort. |
|00001080| 49 74 20 64 69 66 66 65 | 72 73 20 66 72 6f 6d 20 |It diffe|rs from |
|00001090| 49 6e 69 74 47 42 75 66 | 66 65 72 50 69 78 6d 61 |InitGBuf|ferPixma|
|000010a0| 70 0d 20 69 6e 20 74 68 | 61 74 20 69 74 20 61 73 |p. in th|at it as|
|000010b0| 73 6f 63 69 61 74 65 73 | 20 74 68 65 20 62 75 66 |sociates| the buf|
|000010c0| 66 65 72 20 77 69 74 68 | 20 61 6e 20 6f 6e 73 63 |fer with| an onsc|
|000010d0| 72 65 65 6e 20 64 65 76 | 69 63 65 2e 20 54 68 69 |reen dev|ice. Thi|
|000010e0| 73 20 77 69 6c 6c 20 62 | 65 20 74 68 65 20 6d 61 |s will b|e the ma|
|000010f0| 78 69 6d 69 6d 2d 0d 20 | 64 65 70 74 68 20 64 65 |ximim-. |depth de|
|00001100| 76 69 63 65 20 77 68 69 | 63 68 20 69 6e 74 65 72 |vice whi|ch inter|
|00001110| 73 65 63 74 73 20 74 68 | 65 20 67 6c 6f 62 61 6c |sects th|e global|
|00001120| 42 6f 75 6e 64 73 20 72 | 65 63 74 61 6e 67 6c 65 |Bounds r|ectangle|
|00001130| 2e 20 49 6e 20 74 68 65 | 20 6d 6f 73 74 20 63 6f |. In the| most co|
|00001140| 6d 6d 6f 6e 20 63 61 73 | 65 0d 20 79 6f 75 20 77 |mmon cas|e. you w|
|00001150| 69 6c 6c 20 70 61 73 73 | 20 69 6e 20 74 68 65 20 |ill pass| in the |
|00001160| 70 6f 72 74 52 65 63 74 | 20 6f 66 20 61 20 77 69 |portRect| of a wi|
|00001170| 6e 64 6f 77 20 61 66 74 | 65 72 20 63 6f 6e 76 65 |ndow aft|er conve|
|00001180| 72 74 69 6e 67 20 69 74 | 20 74 6f 20 67 6c 6f 62 |rting it| to glob|
|00001190| 61 6c 20 63 6f 6f 72 64 | 69 6e 61 74 65 73 2e 0d |al coord|inates..|
|000011a0| 20 49 66 20 6e 6f 20 73 | 63 72 65 65 6e 20 64 65 | If no s|creen de|
|000011b0| 76 69 63 65 20 69 6e 74 | 65 72 73 65 63 74 73 20 |vice int|ersects |
|000011c0| 67 6c 6f 62 61 6c 42 6f | 75 6e 64 73 2c 20 74 68 |globalBo|unds, th|
|000011d0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 77 69 6c 6c 20 |e functi|on will |
|000011e0| 72 65 74 75 72 6e 20 46 | 41 4c 53 45 20 61 6e 64 |return F|ALSE and|
|000011f0| 0d 20 64 65 76 69 63 65 | 20 77 69 6c 6c 20 72 65 |. device| will re|
|00001200| 74 75 72 6e 20 77 69 74 | 68 20 4e 49 4c 2e 20 49 |turn wit|h NIL. I|
|00001210| 66 20 69 74 20 72 65 74 | 75 72 6e 73 20 54 52 55 |f it ret|urns TRU|
|00001220| 45 20 74 68 65 6e 20 64 | 65 76 69 63 65 20 77 69 |E then d|evice wi|
|00001230| 6c 6c 20 62 65 20 61 20 | 68 61 6e 64 6c 65 20 74 |ll be a |handle t|
|00001240| 6f 0d 20 74 68 65 20 70 | 72 6f 70 65 72 20 47 44 |o. the p|roper GD|
|00001250| 65 76 69 63 65 20 28 73 | 65 65 20 53 74 61 72 74 |evice (s|ee Start|
|00001260| 4c 65 65 63 68 2c 20 62 | 65 6c 6f 77 29 2e 0d 20 |Leech, b|elow).. |
|00001270| 46 6f 72 20 74 68 65 20 | 6f 74 68 65 72 20 69 6e |For the |other in|
|00001280| 66 6f 72 6d 61 74 69 6f | 6e 2c 20 73 65 65 20 74 |formatio|n, see t|
|00001290| 68 65 20 63 6f 6d 6d 65 | 6e 74 73 20 61 74 20 49 |he comme|nts at I|
|000012a0| 6e 69 74 47 42 75 66 66 | 65 72 50 69 78 6d 61 70 |nitGBuff|erPixmap|
|000012b0| 2e 7d 0d 46 55 4e 43 54 | 49 4f 4e 20 49 6e 69 74 |.}.FUNCT|ION Init|
|000012c0| 47 42 75 66 66 65 72 53 | 63 72 65 65 6e 28 70 6d |GBufferS|creen(pm|
|000012d0| 61 70 3a 20 50 69 78 4d | 61 70 48 61 6e 64 6c 65 |ap: PixM|apHandle|
|000012e0| 3b 20 67 6c 6f 62 61 6c | 42 6f 75 6e 64 73 3a 20 |; global|Bounds: |
|000012f0| 52 65 63 74 3b 20 56 41 | 52 20 64 65 76 69 63 65 |Rect; VA|R device|
|00001300| 3a 47 44 48 61 6e 64 6c | 65 3b 0d 20 09 20 56 41 |:GDHandl|e;. . VA|
|00001310| 52 20 64 61 74 61 53 69 | 7a 65 3a 20 4c 4f 4e 47 |R dataSi|ze: LONG|
|00001320| 49 4e 54 29 3a 20 42 4f | 4f 4c 45 41 4e 3b 0d 0d |INT): BO|OLEAN;..|
|00001330| 56 41 52 0d 09 73 61 76 | 65 64 44 65 76 69 63 65 |VAR..sav|edDevice|
|00001340| 3a 09 47 44 48 61 6e 64 | 6c 65 3b 0d 42 45 47 49 |:.GDHand|le;.BEGI|
|00001350| 4e 0d 09 49 6e 69 74 47 | 42 75 66 66 65 72 53 63 |N..InitG|BufferSc|
|00001360| 72 65 65 6e 20 3a 3d 20 | 46 41 4c 53 45 3b 0d 09 |reen := |FALSE;..|
|00001370| 0d 09 64 65 76 69 63 65 | 20 3a 3d 20 47 65 74 4d |..device| := GetM|
|00001380| 61 78 44 65 76 69 63 65 | 28 67 6c 6f 62 61 6c 42 |axDevice|(globalB|
|00001390| 6f 75 6e 64 73 29 3b 09 | 09 7b 6d 61 78 69 6d 75 |ounds);.|.{maximu|
|000013a0| 6d 2d 64 65 70 74 68 20 | 64 65 76 69 63 65 20 66 |m-depth |device f|
|000013b0| 6f 72 20 67 6c 6f 62 61 | 6c 42 6f 75 6e 64 73 7d |or globa|lBounds}|
|000013c0| 0d 09 49 46 20 64 65 76 | 69 63 65 20 3c 3e 20 4e |..IF dev|ice <> N|
|000013d0| 49 4c 20 54 48 45 4e 20 | 42 45 47 49 4e 0d 09 09 |IL THEN |BEGIN...|
|000013e0| 73 61 76 65 64 44 65 76 | 69 63 65 20 3a 3d 20 47 |savedDev|ice := G|
|000013f0| 65 74 47 44 65 76 69 63 | 65 3b 0d 09 09 0d 09 09 |etGDevic|e;......|
|00001400| 57 49 54 48 20 67 6c 6f | 62 61 6c 42 6f 75 6e 64 |WITH glo|balBound|
|00001410| 73 20 44 4f 0d 09 09 09 | 53 65 74 52 65 63 74 28 |s DO....|SetRect(|
|00001420| 67 6c 6f 62 61 6c 42 6f | 75 6e 64 73 2c 20 30 2c |globalBo|unds, 0,|
|00001430| 20 30 2c 20 72 69 67 68 | 74 20 2d 20 6c 65 66 74 | 0, righ|t - left|
|00001440| 2c 20 62 6f 74 74 6f 6d | 20 2d 20 74 6f 70 29 3b |, bottom| - top);|
|00001450| 0d 09 09 7b 6d 61 6b 65 | 20 67 6c 6f 62 61 6c 42 |...{make| globalB|
|00001460| 6f 75 6e 64 73 20 69 6e | 74 6f 20 61 20 77 69 6e |ounds in|to a win|
|00001470| 64 6f 77 2d 69 73 68 20 | 28 7a 65 72 6f 2d 62 61 |dow-ish |(zero-ba|
|00001480| 73 65 64 29 20 72 65 63 | 74 61 6e 67 6c 65 7d 0d |sed) rec|tangle}.|
|00001490| 09 09 09 0d 09 09 53 65 | 74 47 44 65 76 69 63 65 |......Se|tGDevice|
|000014a0| 28 64 65 76 69 63 65 29 | 3b 09 09 09 09 09 09 7b |(device)|;......{|
|000014b0| 73 65 74 20 74 6f 20 64 | 65 76 69 63 65 20 66 6f |set to d|evice fo|
|000014c0| 72 20 49 6e 69 74 47 42 | 75 66 66 65 72 50 69 78 |r InitGB|ufferPix|
|000014d0| 6d 61 70 7d 0d 09 09 57 | 49 54 48 20 64 65 76 69 |map}...W|ITH devi|
|000014e0| 63 65 5e 5e 2e 67 64 50 | 4d 61 70 5e 5e 20 44 4f |ce^^.gdP|Map^^ DO|
|000014f0| 0d 09 09 09 49 6e 69 74 | 47 42 75 66 66 65 72 50 |....Init|GBufferP|
|00001500| 69 78 6d 61 70 28 70 6d | 61 70 2c 20 67 6c 6f 62 |ixmap(pm|ap, glob|
|00001510| 61 6c 42 6f 75 6e 64 73 | 2c 20 70 69 78 65 6c 54 |alBounds|, pixelT|
|00001520| 79 70 65 2c 20 70 69 78 | 65 6c 53 69 7a 65 2c 0d |ype, pix|elSize,.|
|00001530| 20 09 09 09 09 63 6d 70 | 43 6f 75 6e 74 2c 20 63 | ....cmp|Count, c|
|00001540| 6d 70 53 69 7a 65 2c 20 | 70 6d 54 61 62 6c 65 2c |mpSize, |pmTable,|
|00001550| 20 64 61 74 61 53 69 7a | 65 29 3b 0d 09 09 09 7b | dataSiz|e);....{|
|00001560| 73 65 74 20 75 70 20 74 | 68 65 20 70 69 78 6d 61 |set up t|he pixma|
|00001570| 70 7d 0d 09 09 09 0d 09 | 09 53 65 74 47 44 65 76 |p}......|.SetGDev|
|00001580| 69 63 65 28 73 61 76 65 | 64 44 65 76 69 63 65 29 |ice(save|dDevice)|
|00001590| 3b 0d 09 09 49 6e 69 74 | 47 42 75 66 66 65 72 53 |;...Init|GBufferS|
|000015a0| 63 72 65 65 6e 20 3a 3d | 20 54 52 55 45 3b 0d 09 |creen :=| TRUE;..|
|000015b0| 45 4e 44 3b 20 7b 49 46 | 20 64 65 76 69 63 65 20 |END; {IF| device |
|000015c0| 3c 3e 20 4e 49 4c 7d 0d | 45 4e 44 3b 20 7b 49 6e |<> NIL}.|END; {In|
|000015d0| 69 74 47 42 75 66 66 65 | 72 53 63 72 65 65 6e 7d |itGBuffe|rScreen}|
|000015e0| 0d 0d 7b 41 6c 6c 6f 63 | 61 74 65 20 74 68 65 20 |..{Alloc|ate the |
|000015f0| 64 61 74 61 20 73 70 61 | 63 65 20 66 6f 72 20 74 |data spa|ce for t|
|00001600| 68 65 20 62 69 74 73 20 | 6f 66 20 61 6e 20 6f 66 |he bits |of an of|
|00001610| 66 73 63 72 65 65 6e 20 | 62 75 66 66 65 72 2e 20 |fscreen |buffer. |
|00001620| 4f 6e 6c 79 20 64 6f 20 | 73 6f 20 69 66 0d 20 69 |Only do |so if. i|
|00001630| 74 20 63 61 6e 20 62 65 | 20 61 6c 6c 6f 63 61 74 |t can be| allocat|
|00001640| 65 64 20 69 6e 20 61 6e | 20 6f 70 74 69 6d 75 6d |ed in an| optimum|
|00001650| 20 70 6c 61 63 65 20 66 | 6f 72 20 67 72 61 70 68 | place f|or graph|
|00001660| 69 63 73 20 75 73 65 2e | 20 49 66 20 74 68 65 20 |ics use.| If the |
|00001670| 73 79 73 74 65 6d 0d 20 | 64 6f 65 73 6e d5 74 20 |system. |doesn.t |
|00001680| 68 61 76 65 20 61 20 73 | 75 70 65 72 69 6f 72 20 |have a s|uperior |
|00001690| 70 6c 61 63 65 20 74 6f | 20 61 6c 6c 6f 63 61 74 |place to| allocat|
|000016a0| 65 20 74 68 65 20 62 69 | 74 73 2c 20 4e 49 4c 20 |e the bi|ts, NIL |
|000016b0| 69 73 20 72 65 74 75 72 | 6e 65 64 2e 0d 20 6e 65 |is retur|ned.. ne|
|000016c0| 65 64 73 33 32 42 69 74 | 73 20 77 69 6c 6c 20 72 |eds32Bit|s will r|
|000016d0| 65 74 75 72 6e 20 54 52 | 55 45 20 69 66 20 74 68 |eturn TR|UE if th|
|000016e0| 65 20 62 69 74 20 73 70 | 61 63 65 20 72 65 71 75 |e bit sp|ace requ|
|000016f0| 69 72 65 73 20 33 32 20 | 62 69 74 20 61 64 64 72 |ires 32 |bit addr|
|00001700| 65 73 73 69 6e 67 0d 20 | 69 6e 20 6f 72 64 65 72 |essing. |in order|
|00001710| 20 74 6f 20 61 63 63 65 | 73 73 20 69 74 2e 20 62 | to acce|ss it. b|
|00001720| 75 66 66 4e 6f 74 4e 65 | 65 64 65 64 20 77 69 6c |uffNotNe|eded wil|
|00001730| 6c 20 72 65 74 75 72 6e | 20 54 52 55 45 20 69 66 |l return| TRUE if|
|00001740| 20 70 65 72 66 6f 72 6d | 61 6e 63 65 20 77 69 6c | perform|ance wil|
|00001750| 6c 20 62 65 0d 20 69 6d | 70 72 6f 76 65 64 20 62 |l be. im|proved b|
|00001760| 79 20 4e 4f 54 20 62 75 | 66 66 65 72 69 6e 67 20 |y NOT bu|ffering |
|00001770| 28 d2 70 65 72 66 6f 72 | 6d 61 6e 63 65 d3 20 6d |(.perfor|mance. m|
|00001780| 65 61 6e 73 20 61 76 6f | 69 64 69 6e 67 20 66 6c |eans avo|iding fl|
|00001790| 69 63 6b 65 72 2c 20 65 | 74 63 2e 29 7d 0d 46 55 |icker, e|tc.)}.FU|
|000017a0| 4e 43 54 49 4f 4e 20 4e | 65 77 49 6d 70 72 6f 76 |NCTION N|ewImprov|
|000017b0| 65 64 47 42 75 66 66 65 | 72 28 64 61 74 61 53 69 |edGBuffe|r(dataSi|
|000017c0| 7a 65 3a 20 4c 4f 4e 47 | 49 4e 54 3b 20 56 41 52 |ze: LONG|INT; VAR|
|000017d0| 20 6e 65 65 64 73 33 32 | 42 69 74 73 3a 20 42 4f | needs32|Bits: BO|
|000017e0| 4f 4c 45 41 4e 3b 0d 09 | 09 09 56 41 52 20 62 75 |OLEAN;..|..VAR bu|
|000017f0| 66 66 4e 6f 74 4e 65 65 | 64 65 64 3a 20 42 4f 4f |ffNotNee|ded: BOO|
|00001800| 4c 45 41 4e 29 3a 20 50 | 74 72 3b 0d 0d 42 45 47 |LEAN): P|tr;..BEG|
|00001810| 49 4e 0d 09 4e 65 77 49 | 6d 70 72 6f 76 65 64 47 |IN..NewI|mprovedG|
|00001820| 42 75 66 66 65 72 20 3a | 3d 20 4e 49 4c 3b 0d 09 |Buffer :|= NIL;..|
|00001830| 6e 65 65 64 73 33 32 42 | 69 74 73 20 3a 3d 20 46 |needs32B|its := F|
|00001840| 41 4c 53 45 3b 0d 09 62 | 75 66 66 4e 6f 74 4e 65 |ALSE;..b|uffNotNe|
|00001850| 65 64 65 64 20 3a 3d 20 | 46 41 4c 53 45 3b 0d 45 |eded := |FALSE;.E|
|00001860| 4e 44 3b 20 7b 4e 65 77 | 49 6d 70 72 6f 76 65 64 |ND; {New|Improved|
|00001870| 47 42 75 66 66 65 72 7d | 0d 0d 7b 46 72 65 65 20 |GBuffer}|..{Free |
|00001880| 61 20 62 75 66 66 65 72 | 20 61 6c 6c 6f 63 61 74 |a buffer| allocat|
|00001890| 65 64 20 76 69 61 20 4e | 65 77 49 6d 70 72 6f 76 |ed via N|ewImprov|
|000018a0| 65 64 47 42 75 66 66 65 | 72 2e 7d 0d 50 52 4f 43 |edGBuffe|r.}.PROC|
|000018b0| 45 44 55 52 45 20 46 72 | 65 65 45 6e 68 61 6e 63 |EDURE Fr|eeEnhanc|
|000018c0| 65 64 47 42 75 66 66 65 | 72 28 62 69 74 73 3a 20 |edGBuffe|r(bits: |
|000018d0| 50 74 72 29 3b 0d 0d 42 | 45 47 49 4e 0d 45 4e 44 |Ptr);..B|EGIN.END|
|000018e0| 3b 20 7b 46 72 65 65 45 | 6e 68 61 6e 63 65 64 47 |; {FreeE|nhancedG|
|000018f0| 42 75 66 66 65 72 7d 0d | 0d 7b 46 69 6c 6c 20 6f |Buffer}.|.{Fill o|
|00001900| 75 74 20 74 68 65 20 47 | 44 65 76 69 63 65 20 72 |ut the G|Device r|
|00001910| 65 63 6f 72 64 20 61 6e | 64 20 73 65 74 20 64 65 |ecord an|d set de|
|00001920| 76 69 63 65 5e 5e 2e 67 | 64 50 4d 61 70 20 3d 20 |vice^^.g|dPMap = |
|00001930| 70 69 78 6d 61 70 2e 20 | 45 72 72 6f 72 73 20 63 |pixmap. |Errors c|
|00001940| 61 6e 20 6f 63 63 75 72 | 20 66 72 6f 6d 20 6e 6f |an occur| from no|
|00001950| 74 0d 20 62 65 69 6e 67 | 20 61 62 6c 65 20 74 6f |t. being| able to|
|00001960| 20 62 75 69 6c 64 20 74 | 68 65 20 49 54 61 62 6c | build t|he ITabl|
|00001970| 65 2c 20 65 74 63 2e 7d | 0d 46 55 4e 43 54 49 4f |e, etc.}|.FUNCTIO|
|00001980| 4e 20 49 6e 69 74 47 42 | 75 66 66 65 72 44 65 76 |N InitGB|ufferDev|
|00001990| 69 63 65 28 64 65 76 69 | 63 65 3a 20 47 44 48 61 |ice(devi|ce: GDHa|
|000019a0| 6e 64 6c 65 3b 20 70 6d | 61 70 3a 20 50 69 78 4d |ndle; pm|ap: PixM|
|000019b0| 61 70 48 61 6e 64 6c 65 | 29 3a 20 4f 53 45 72 72 |apHandle|): OSErr|
|000019c0| 3b 0d 0d 56 41 52 0d 09 | 70 72 65 66 65 72 72 65 |;..VAR..|preferre|
|000019d0| 64 52 65 73 6f 6c 75 74 | 69 6f 6e 3a 09 49 4e 54 |dResolut|ion:.INT|
|000019e0| 45 47 45 52 3b 0d 09 69 | 6e 76 65 72 73 65 54 61 |EGER;..i|nverseTa|
|000019f0| 62 6c 65 3a 20 09 09 09 | 49 54 61 62 48 61 6e 64 |ble: ...|ITabHand|
|00001a00| 6c 65 3b 0d 0d 09 50 52 | 4f 43 45 44 55 52 45 20 |le;...PR|OCEDURE |
|00001a10| 4f 75 74 28 65 72 72 6f | 72 3a 20 4f 53 45 72 72 |Out(erro|r: OSErr|
|00001a20| 29 3b 0d 09 42 45 47 49 | 4e 20 7b 4f 75 74 7d 0d |);..BEGI|N {Out}.|
|00001a30| 09 09 49 46 20 65 72 72 | 6f 72 20 3c 3e 20 6e 6f |..IF err|or <> no|
|00001a40| 45 72 72 20 54 48 45 4e | 20 42 45 47 49 4e 0d 09 |Err THEN| BEGIN..|
|00001a50| 09 09 44 69 73 70 6f 73 | 48 61 6e 64 6c 65 28 48 |..Dispos|Handle(H|
|00001a60| 61 6e 64 6c 65 28 64 65 | 76 69 63 65 5e 5e 2e 67 |andle(de|vice^^.g|
|00001a70| 64 49 54 61 62 6c 65 29 | 29 3b 09 7b 67 65 74 20 |dITable)|);.{get |
|00001a80| 72 69 64 20 6f 66 20 74 | 68 65 20 69 6e 76 65 72 |rid of t|he inver|
|00001a90| 73 65 20 74 61 62 6c 65 | 7d 0d 09 09 09 49 6e 69 |se table|}....Ini|
|00001aa0| 74 47 42 75 66 66 65 72 | 44 65 76 69 63 65 20 3a |tGBuffer|Device :|
|00001ab0| 3d 20 65 72 72 6f 72 3b | 0d 09 09 09 45 58 49 54 |= error;|....EXIT|
|00001ac0| 28 49 6e 69 74 47 42 75 | 66 66 65 72 44 65 76 69 |(InitGBu|fferDevi|
|00001ad0| 63 65 29 3b 0d 09 09 45 | 4e 44 3b 20 7b 49 46 20 |ce);...E|ND; {IF |
|00001ae0| 65 72 72 6f 72 20 3c 3e | 20 6e 6f 45 72 72 7d 0d |error <>| noErr}.|
|00001af0| 09 45 4e 44 3b 20 7b 4f | 75 74 7d 0d 0d 42 45 47 |.END; {O|ut}..BEG|
|00001b00| 49 4e 0d 09 64 65 76 69 | 63 65 5e 5e 2e 67 64 49 |IN..devi|ce^^.gdI|
|00001b10| 54 61 62 6c 65 20 3a 3d | 20 4e 49 4c 3b 0d 09 69 |Table :=| NIL;..i|
|00001b20| 6e 76 65 72 73 65 54 61 | 62 6c 65 20 3a 3d 20 49 |nverseTa|ble := I|
|00001b30| 54 61 62 48 61 6e 64 6c | 65 28 4e 65 77 48 61 6e |TabHandl|e(NewHan|
|00001b40| 64 6c 65 28 30 29 29 3b | 09 7b 63 72 65 61 74 65 |dle(0));|.{create|
|00001b50| 20 74 68 65 20 69 6e 76 | 65 72 73 65 20 74 61 62 | the inv|erse tab|
|00001b60| 6c 65 20 73 74 75 62 7d | 0d 09 4f 75 74 28 4d 65 |le stub}|..Out(Me|
|00001b70| 6d 45 72 72 6f 72 29 3b | 09 09 09 09 09 09 09 09 |mError);|........|
|00001b80| 7b 62 61 69 6c 20 69 66 | 20 63 6f 75 6c 64 6e d5 |{bail if| couldn.|
|00001b90| 74 20 6d 61 6b 65 20 74 | 68 65 20 68 61 6e 64 6c |t make t|he handl|
|00001ba0| 65 7d 0d 09 4d 61 6b 65 | 49 54 61 62 6c 65 28 70 |e}..Make|ITable(p|
|00001bb0| 6d 61 70 5e 5e 2e 70 6d | 54 61 62 6c 65 2c 20 69 |map^^.pm|Table, i|
|00001bc0| 6e 76 65 72 73 65 54 61 | 62 6c 65 2c 20 70 72 65 |nverseTa|ble, pre|
|00001bd0| 66 65 72 72 65 64 52 65 | 73 6f 6c 75 74 69 6f 6e |ferredRe|solution|
|00001be0| 29 3b 0d 09 4f 75 74 28 | 51 44 45 72 72 6f 72 29 |);..Out(|QDError)|
|00001bf0| 3b 09 09 09 09 09 09 09 | 09 7b 62 61 69 6c 20 69 |;.......|.{bail i|
|00001c00| 66 20 4d 61 6b 65 49 54 | 61 62 6c 65 20 66 61 69 |f MakeIT|able fai|
|00001c10| 6c 65 64 7d 0d 09 0d 09 | 70 72 65 66 65 72 72 65 |led}....|preferre|
|00001c20| 64 52 65 73 6f 6c 75 74 | 69 6f 6e 20 3a 3d 20 47 |dResolut|ion := G|
|00001c30| 65 74 4d 61 69 6e 44 65 | 76 69 63 65 5e 5e 2e 67 |etMainDe|vice^^.g|
|00001c40| 64 52 65 73 50 72 65 66 | 3b 20 7b 70 72 65 66 65 |dResPref|; {prefe|
|00001c50| 72 72 65 64 20 72 65 73 | 6f 6c 75 74 69 6f 6e 20 |rred res|olution |
|00001c60| 3f 3f 3f 20 69 73 20 74 | 68 69 73 20 63 6f 6f 6c |??? is t|his cool|
|00001c70| 3f 7d 0d 09 0d 09 57 49 | 54 48 20 64 65 76 69 63 |?}....WI|TH devic|
|00001c80| 65 5e 5e 20 44 4f 20 42 | 45 47 49 4e 0d 09 09 67 |e^^ DO B|EGIN...g|
|00001c90| 64 54 79 70 65 20 3a 3d | 20 63 6c 75 74 54 79 70 |dType :=| clutTyp|
|00001ca0| 65 3b 09 09 09 09 09 09 | 7b 6e 6f 20 70 72 69 76 |e;......|{no priv|
|00001cb0| 61 74 65 20 64 65 76 69 | 63 65 73 20 66 6f 72 20 |ate devi|ces for |
|00001cc0| 64 69 72 65 63 74 20 6f | 6e 65 73 2c 20 72 69 67 |direct o|nes, rig|
|00001cd0| 68 74 3f 7d 09 0d 09 09 | 67 64 49 54 61 62 6c 65 |ht?}....|gdITable|
|00001ce0| 20 3a 3d 20 69 6e 76 65 | 72 73 65 54 61 62 6c 65 | := inve|rseTable|
|00001cf0| 3b 0d 09 09 67 64 52 65 | 73 50 72 65 66 20 3a 3d |;...gdRe|sPref :=|
|00001d00| 20 70 72 65 66 65 72 72 | 65 64 52 65 73 6f 6c 75 | preferr|edResolu|
|00001d10| 74 69 6f 6e 3b 0d 09 09 | 67 64 46 6c 61 67 73 20 |tion;...|gdFlags |
|00001d20| 3a 3d 20 32 20 2a 2a 20 | 6e 6f 44 72 69 76 65 72 |:= 2 ** |noDriver|
|00001d30| 3b 0d 09 09 67 64 50 4d | 61 70 20 3a 3d 20 70 6d |;...gdPM|ap := pm|
|00001d40| 61 70 3b 0d 09 09 67 64 | 52 65 63 74 20 3a 3d 20 |ap;...gd|Rect := |
|00001d50| 70 6d 61 70 5e 5e 2e 62 | 6f 75 6e 64 73 3b 0d 09 |pmap^^.b|ounds;..|
|00001d60| 45 4e 44 3b 20 7b 57 49 | 54 48 7d 0d 09 0d 09 49 |END; {WI|TH}....I|
|00001d70| 6e 69 74 47 42 75 66 66 | 65 72 44 65 76 69 63 65 |nitGBuff|erDevice|
|00001d80| 20 3a 3d 20 6e 6f 45 72 | 72 3b 0d 45 4e 44 3b 20 | := noEr|r;.END; |
|00001d90| 7b 49 6e 69 74 47 42 75 | 66 66 65 72 44 65 76 69 |{InitGBu|fferDevi|
|00001da0| 63 65 7d 0d 0d 0d 7b 2d | 2d 2d 2d 2d 2d 2d 2d 2d |ce}...{-|--------|
|00001db0| 2d 20 65 6e 64 20 6f 66 | 20 6c 6f 77 2d 6c 65 76 |- end of| low-lev|
|00001dc0| 65 6c 20 73 65 72 76 69 | 63 65 20 72 6f 75 74 69 |el servi|ce routi|
|00001dd0| 6e 65 73 20 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 7d 0d |nes ----|------}.|
|00001de0| 0d 0d 50 52 4f 43 45 44 | 55 52 45 20 49 6e 69 74 |..PROCED|URE Init|
|00001df0| 4f 66 66 73 63 72 65 65 | 6e 3b 0d 7b 31 32 38 4b |Offscree|n;.{128K|
|00001e00| 20 52 4f 4d 73 20 61 6e | 64 20 6e 65 77 20 65 6e | ROMs an|d new en|
|00001e10| 6f 75 67 68 20 50 61 6c | 65 74 74 65 20 4d 61 6e |ough Pal|ette Man|
|00001e20| 61 67 65 72 7d 0d 0d 56 | 41 52 0d 09 65 72 72 6f |ager}..V|AR..erro|
|00001e30| 72 09 3a 20 4f 53 45 72 | 72 3b 0d 0d 42 45 47 49 |r.: OSEr|r;..BEGI|
|00001e40| 4e 20 7b 49 6e 69 74 4f | 66 66 73 63 72 65 65 6e |N {InitO|ffscreen|
|00001e50| 7d 0d 09 65 72 72 6f 72 | 20 3a 3d 20 53 79 73 45 |}..error| := SysE|
|00001e60| 6e 76 69 72 6f 6e 73 28 | 31 2c 20 74 68 65 4d 61 |nvirons(|1, theMa|
|00001e70| 63 29 3b 0d 45 4e 44 3b | 20 7b 49 6e 69 74 4f 66 |c);.END;| {InitOf|
|00001e80| 66 73 63 72 65 65 6e 7d | 0d 0d 0d 28 2a 20 3f 3f |fscreen}|...(* ??|
|00001e90| 3f 20 63 6f 6d 6d 65 6e | 74 65 64 20 6f 75 74 20 |? commen|ted out |
|00001ea0| 73 69 6e 63 65 20 77 65 | 20 6e 6f 20 6c 6f 6e 67 |since we| no long|
|00001eb0| 65 72 20 75 73 65 20 69 | 74 20 28 62 75 74 20 73 |er use i|t (but s|
|00001ec0| 6f 6d 65 6f 6e 65 20 6d | 61 79 20 77 61 6e 74 20 |omeone m|ay want |
|00001ed0| 69 74 2c 20 73 6f 20 73 | 68 6f 75 6c 64 20 77 65 |it, so s|hould we|
|00001ee0| 20 70 72 6f 76 69 64 65 | 20 69 74 20 61 73 20 61 | provide| it as a|
|00001ef0| 20 75 74 69 6c 69 74 79 | 3f 29 0d 46 55 4e 43 54 | utility|?).FUNCT|
|00001f00| 49 4f 4e 20 47 65 74 4d | 61 78 41 72 65 61 44 65 |ION GetM|axAreaDe|
|00001f10| 76 69 63 65 28 67 6c 6f | 62 61 6c 52 65 63 74 3a |vice(glo|balRect:|
|00001f20| 20 52 65 63 74 29 3a 20 | 47 44 48 61 6e 64 6c 65 | Rect): |GDHandle|
|00001f30| 3b 0d 7b 46 69 6e 64 20 | 74 68 65 20 67 72 65 61 |;.{Find |the grea|
|00001f40| 74 65 73 74 20 6f 76 65 | 72 6c 61 70 20 64 65 76 |test ove|rlap dev|
|00001f50| 69 63 65 20 66 6f 72 20 | 74 68 65 20 67 69 76 65 |ice for |the give|
|00001f60| 6e 20 67 6c 6f 62 61 6c | 20 72 65 63 74 61 6e 67 |n global| rectang|
|00001f70| 6c 65 2e 7d 0d 0d 56 41 | 52 0d 09 61 72 65 61 09 |le.}..VA|R..area.|
|00001f80| 09 09 3a 20 4c 4f 4e 47 | 49 4e 54 3b 0d 09 6d 61 |..: LONG|INT;..ma|
|00001f90| 78 41 72 65 61 09 09 09 | 3a 20 4c 4f 4e 47 49 4e |xArea...|: LONGIN|
|00001fa0| 54 3b 0d 09 64 65 76 69 | 63 65 09 09 09 3a 20 47 |T;..devi|ce...: G|
|00001fb0| 44 48 61 6e 64 6c 65 3b | 0d 09 69 6e 74 65 72 73 |DHandle;|..inters|
|00001fc0| 65 63 74 69 6f 6e 09 3a | 20 52 65 63 74 3b 0d 0d |ection.:| Rect;..|
|00001fd0| 42 45 47 49 4e 20 7b 47 | 65 74 4d 61 78 41 72 65 |BEGIN {G|etMaxAre|
|00001fe0| 61 44 65 76 69 63 65 7d | 0d 09 47 65 74 4d 61 78 |aDevice}|..GetMax|
|00001ff0| 41 72 65 61 44 65 76 69 | 63 65 20 3a 3d 20 4e 49 |AreaDevi|ce := NI|
|00002000| 4c 3b 0d 0d 09 6d 61 78 | 41 72 65 61 20 3a 3d 20 |L;...max|Area := |
|00002010| 30 3b 0d 0d 09 64 65 76 | 69 63 65 20 3a 3d 20 47 |0;...dev|ice := G|
|00002020| 65 74 44 65 76 69 63 65 | 4c 69 73 74 3b 0d 09 57 |etDevice|List;..W|
|00002030| 48 49 4c 45 20 64 65 76 | 69 63 65 20 3c 3e 20 4e |HILE dev|ice <> N|
|00002040| 49 4c 20 44 4f 20 42 45 | 47 49 4e 0d 09 09 49 46 |IL DO BE|GIN...IF|
|00002050| 20 54 65 73 74 44 65 76 | 69 63 65 41 74 74 72 69 | TestDev|iceAttri|
|00002060| 62 75 74 65 28 64 65 76 | 69 63 65 2c 20 73 63 72 |bute(dev|ice, scr|
|00002070| 65 65 6e 44 65 76 69 63 | 65 29 20 54 48 45 4e 0d |eenDevic|e) THEN.|
|00002080| 09 09 09 49 46 20 54 65 | 73 74 44 65 76 69 63 65 |...IF Te|stDevice|
|00002090| 41 74 74 72 69 62 75 74 | 65 28 64 65 76 69 63 65 |Attribut|e(device|
|000020a0| 2c 20 73 63 72 65 65 6e | 41 63 74 69 76 65 29 20 |, screen|Active) |
|000020b0| 54 48 45 4e 0d 09 09 09 | 09 49 46 20 53 65 63 74 |THEN....|.IF Sect|
|000020c0| 52 65 63 74 28 67 6c 6f | 62 61 6c 52 65 63 74 2c |Rect(glo|balRect,|
|000020d0| 20 64 65 76 69 63 65 5e | 5e 2e 67 64 52 65 63 74 | device^|^.gdRect|
|000020e0| 2c 20 69 6e 74 65 72 73 | 65 63 74 69 6f 6e 29 20 |, inters|ection) |
|000020f0| 54 48 45 4e 20 42 45 47 | 49 4e 0d 09 09 09 09 09 |THEN BEG|IN......|
|00002100| 57 49 54 48 20 69 6e 74 | 65 72 73 65 63 74 69 6f |WITH int|ersectio|
|00002110| 6e 20 44 4f 0d 09 09 09 | 09 09 09 61 72 65 61 20 |n DO....|...area |
|00002120| 3a 3d 20 4c 4f 4e 47 49 | 4e 54 28 72 69 67 68 74 |:= LONGI|NT(right|
|00002130| 20 2d 20 6c 65 66 74 29 | 20 2a 20 4c 4f 4e 47 49 | - left)| * LONGI|
|00002140| 4e 54 28 62 6f 74 74 6f | 6d 20 2d 20 74 6f 70 29 |NT(botto|m - top)|
|00002150| 3b 0d 09 09 09 09 09 49 | 46 20 61 72 65 61 20 3e |;......I|F area >|
|00002160| 20 6d 61 78 41 72 65 61 | 20 54 48 45 4e 20 42 45 | maxArea| THEN BE|
|00002170| 47 49 4e 0d 09 09 09 09 | 09 09 47 65 74 4d 61 78 |GIN.....|..GetMax|
|00002180| 41 72 65 61 44 65 76 69 | 63 65 20 3a 3d 20 64 65 |AreaDevi|ce := de|
|00002190| 76 69 63 65 3b 0d 09 09 | 09 09 09 09 6d 61 78 41 |vice;...|....maxA|
|000021a0| 72 65 61 20 3a 3d 20 61 | 72 65 61 3b 0d 09 09 09 |rea := a|rea;....|
|000021b0| 09 09 45 4e 44 3b 20 7b | 49 46 20 61 72 65 61 20 |..END; {|IF area |
|000021c0| 3e 20 6d 61 78 41 72 65 | 61 7d 0d 09 09 09 09 45 |> maxAre|a}.....E|
|000021d0| 4e 44 3b 20 7b 49 46 20 | 53 65 63 74 52 65 63 74 |ND; {IF |SectRect|
|000021e0| 2e 2e 2e 7d 0d 09 09 64 | 65 76 69 63 65 20 3a 3d |...}...d|evice :=|
|000021f0| 20 47 65 74 4e 65 78 74 | 44 65 76 69 63 65 28 64 | GetNext|Device(d|
|00002200| 65 76 69 63 65 29 3b 0d | 09 45 4e 44 3b 20 7b 57 |evice);.|.END; {W|
|00002210| 48 49 4c 45 20 64 65 76 | 69 63 65 20 3c 3e 20 4e |HILE dev|ice <> N|
|00002220| 49 4c 7d 0d 45 4e 44 3b | 20 7b 47 65 74 4d 61 78 |IL}.END;| {GetMax|
|00002230| 41 72 65 61 44 65 76 69 | 63 65 7d 0d 2a 29 0d 0d |AreaDevi|ce}.*)..|
|00002240| 0d 0d 46 55 4e 43 54 49 | 4f 4e 20 4d 61 6b 65 43 |..FUNCTI|ON MakeC|
|00002250| 6c 65 61 6e 43 6f 6c 6f | 72 54 61 62 6c 65 28 63 |leanColo|rTable(c|
|00002260| 6f 6c 6f 72 73 3a 20 43 | 54 61 62 48 61 6e 64 6c |olors: C|TabHandl|
|00002270| 65 3b 20 64 65 70 74 68 | 3a 20 49 4e 54 45 47 45 |e; depth|: INTEGE|
|00002280| 52 3b 0d 09 09 09 09 09 | 09 09 20 56 41 52 20 74 |R;......|.. VAR t|
|00002290| 61 62 6c 65 3a 20 43 54 | 61 62 48 61 6e 64 6c 65 |able: CT|abHandle|
|000022a0| 29 3a 20 4f 53 45 72 72 | 3b 0d 7b 54 68 69 73 20 |): OSErr|;.{This |
|000022b0| 63 61 6c 6c 20 74 61 6b | 65 73 20 61 20 68 61 6e |call tak|es a han|
|000022c0| 64 6c 65 20 74 6f 20 61 | 20 6c 69 73 74 20 6f 66 |dle to a| list of|
|000022d0| 20 63 6f 6c 6f 72 73 20 | 74 6f 20 62 65 20 69 6e | colors |to be in|
|000022e0| 63 6c 75 64 65 64 20 69 | 6e 20 61 20 63 6f 6c 6f |cluded i|n a colo|
|000022f0| 72 20 74 61 62 6c 65 2e | 0d 20 49 74 20 72 65 74 |r table.|. It ret|
|00002300| 75 72 6e 73 20 61 20 74 | 61 62 6c 65 20 73 75 69 |urns a t|able sui|
|00002310| 74 61 62 6c 65 20 66 6f | 72 20 75 73 65 20 66 6f |table fo|r use fo|
|00002320| 72 20 61 20 50 69 78 4d | 61 70 2c 20 77 69 74 68 |r a PixM|ap, with|
|00002330| 20 62 6c 61 63 6b 20 61 | 6e 64 20 77 68 69 74 65 | black a|nd white|
|00002340| 20 61 74 20 74 68 65 0d | 20 63 6f 72 72 65 63 74 | at the.| correct|
|00002350| 20 6f 66 66 73 65 74 73 | 2e 20 49 66 20 74 68 65 | offsets|. If the|
|00002360| 72 65 20 69 73 20 6e 6f | 20 64 65 66 61 75 6c 74 |re is no| default|
|00002370| 20 63 6f 6c 6f 72 20 74 | 61 62 6c 65 20 66 6f 72 | color t|able for|
|00002380| 20 74 68 65 20 64 65 70 | 74 68 20 69 6e 20 71 75 | the dep|th in qu|
|00002390| 65 73 74 69 6f 6e 2c 0d | 20 69 74 20 72 65 74 75 |estion,.| it retu|
|000023a0| 72 6e 73 20 4e 49 4c 20 | 66 6f 72 20 74 68 65 20 |rns NIL |for the |
|000023b0| 74 61 62 6c 65 2e 7d 0d | 0d 09 46 55 4e 43 54 49 |table.}.|..FUNCTI|
|000023c0| 4f 4e 20 49 73 57 68 69 | 74 65 28 72 67 62 3a 20 |ON IsWhi|te(rgb: |
|000023d0| 52 47 42 43 6f 6c 6f 72 | 29 3a 20 42 4f 4f 4c 45 |RGBColor|): BOOLE|
|000023e0| 41 4e 3b 0d 09 42 45 47 | 49 4e 20 7b 49 73 57 68 |AN;..BEG|IN {IsWh|
|000023f0| 69 74 65 7d 0d 09 09 49 | 73 57 68 69 74 65 20 3a |ite}...I|sWhite :|
|00002400| 3d 20 28 72 67 62 2e 72 | 65 64 20 3d 20 24 46 46 |= (rgb.r|ed = $FF|
|00002410| 46 46 29 20 26 20 28 72 | 67 62 2e 67 72 65 65 6e |FF) & (r|gb.green|
|00002420| 20 3d 20 24 46 46 46 46 | 29 20 26 20 28 72 67 62 | = $FFFF|) & (rgb|
|00002430| 2e 62 6c 75 65 20 3d 20 | 24 46 46 46 46 29 3b 0d |.blue = |$FFFF);.|
|00002440| 09 45 4e 44 3b 20 7b 49 | 73 57 68 69 74 65 7d 0d |.END; {I|sWhite}.|
|00002450| 0d 09 46 55 4e 43 54 49 | 4f 4e 20 49 73 42 6c 61 |..FUNCTI|ON IsBla|
|00002460| 63 6b 28 72 67 62 3a 20 | 52 47 42 43 6f 6c 6f 72 |ck(rgb: |RGBColor|
|00002470| 29 3a 20 42 4f 4f 4c 45 | 41 4e 3b 0d 09 42 45 47 |): BOOLE|AN;..BEG|
|00002480| 49 4e 20 7b 49 73 42 6c | 61 63 6b 7d 0d 09 09 49 |IN {IsBl|ack}...I|
|00002490| 73 42 6c 61 63 6b 20 3a | 3d 20 28 72 67 62 2e 72 |sBlack :|= (rgb.r|
|000024a0| 65 64 20 3d 20 30 29 20 | 26 20 28 72 67 62 2e 67 |ed = 0) |& (rgb.g|
|000024b0| 72 65 65 6e 20 3d 20 30 | 29 20 26 20 28 72 67 62 |reen = 0|) & (rgb|
|000024c0| 2e 62 6c 75 65 20 3d 20 | 30 29 3b 0d 09 45 4e 44 |.blue = |0);..END|
|000024d0| 3b 20 7b 49 73 42 6c 61 | 63 6b 7d 0d 0d 56 41 52 |; {IsBla|ck}..VAR|
|000024e0| 0d 09 74 61 62 6c 65 49 | 6e 64 65 78 09 3a 20 49 |..tableI|ndex.: I|
|000024f0| 4e 54 45 47 45 52 3b 0d | 09 63 6f 6c 6f 72 49 6e |NTEGER;.|.colorIn|
|00002500| 64 65 78 09 3a 20 49 4e | 54 45 47 45 52 3b 0d 09 |dex.: IN|TEGER;..|
|00002510| 61 43 6f 6c 6f 72 09 09 | 3a 20 52 47 42 43 6f 6c |aColor..|: RGBCol|
|00002520| 6f 72 3b 0d 0d 42 45 47 | 49 4e 20 7b 4d 61 6b 65 |or;..BEG|IN {Make|
|00002530| 43 6c 65 61 6e 43 6f 6c | 6f 72 54 61 62 6c 65 7d |CleanCol|orTable}|
|00002540| 0d 09 74 61 62 6c 65 20 | 3a 3d 20 47 65 74 43 54 |..table |:= GetCT|
|00002550| 61 62 6c 65 28 64 65 70 | 74 68 29 3b 0d 09 49 46 |able(dep|th);..IF|
|00002560| 20 74 61 62 6c 65 20 3d | 20 4e 49 4c 20 54 48 45 | table =| NIL THE|
|00002570| 4e 0d 09 09 4d 61 6b 65 | 43 6c 65 61 6e 43 6f 6c |N...Make|CleanCol|
|00002580| 6f 72 54 61 62 6c 65 20 | 3a 3d 20 6d 65 6d 46 75 |orTable |:= memFu|
|00002590| 6c 6c 45 72 72 0d 09 45 | 4c 53 45 0d 09 09 57 49 |llErr..E|LSE...WI|
|000025a0| 54 48 20 74 61 62 6c 65 | 5e 5e 20 44 4f 20 42 45 |TH table|^^ DO BE|
|000025b0| 47 49 4e 0d 09 09 09 63 | 74 53 65 65 64 20 3a 3d |GIN....c|tSeed :=|
|000025c0| 20 47 65 74 43 54 53 65 | 65 64 3b 20 7b 67 65 74 | GetCTSe|ed; {get|
|000025d0| 20 61 20 66 72 65 73 68 | 20 73 65 65 64 3b 20 77 | a fresh| seed; w|
|000025e0| 65 27 6c 6c 20 63 68 61 | 6e 67 65 20 74 68 65 20 |e'll cha|nge the |
|000025f0| 63 6f 6c 6f 72 20 74 61 | 62 6c 65 7d 0d 0d 09 09 |color ta|ble}....|
|00002600| 09 74 61 62 6c 65 49 6e | 64 65 78 20 3a 3d 20 31 |.tableIn|dex := 1|
|00002610| 3b 20 7b 73 6b 69 70 20 | 77 68 69 74 65 20 69 6e |; {skip |white in|
|00002620| 20 74 61 62 6c 65 20 77 | 65 20 61 72 65 20 6d 61 | table w|e are ma|
|00002630| 6b 69 6e 67 7d 0d 09 09 | 09 63 6f 6c 6f 72 49 6e |king}...|.colorIn|
|00002640| 64 65 78 20 3a 3d 20 30 | 3b 20 7b 73 74 61 72 74 |dex := 0|; {start|
|00002650| 20 77 69 74 68 20 66 69 | 72 73 74 20 63 6f 6c 6f | with fi|rst colo|
|00002660| 72 7d 0d 0d 09 09 09 52 | 45 50 45 41 54 0d 09 09 |r}.....R|EPEAT...|
|00002670| 09 09 49 46 20 63 6f 6c | 6f 72 49 6e 64 65 78 20 |..IF col|orIndex |
|00002680| 3e 20 63 6f 6c 6f 72 73 | 5e 5e 2e 63 74 53 69 7a |> colors|^^.ctSiz|
|00002690| 65 20 54 48 45 4e 0d 09 | 09 09 09 09 4c 65 61 76 |e THEN..|....Leav|
|000026a0| 65 3b 20 7b 64 6f 6e 65 | 20 77 69 74 68 20 61 6c |e; {done| with al|
|000026b0| 6c 20 74 68 65 20 63 6f | 6c 6f 72 73 7d 0d 09 09 |l the co|lors}...|
|000026c0| 09 09 61 43 6f 6c 6f 72 | 20 3a 3d 20 63 6f 6c 6f |..aColor| := colo|
|000026d0| 72 73 5e 5e 2e 63 74 54 | 61 62 6c 65 5b 63 6f 6c |rs^^.ctT|able[col|
|000026e0| 6f 72 49 6e 64 65 78 5d | 2e 72 67 62 3b 0d 09 09 |orIndex]|.rgb;...|
|000026f0| 09 09 63 6f 6c 6f 72 49 | 6e 64 65 78 20 3a 3d 20 |..colorI|ndex := |
|00002700| 63 6f 6c 6f 72 49 6e 64 | 65 78 20 2b 20 31 3b 20 |colorInd|ex + 1; |
|00002710| 7b 61 64 76 61 6e 63 65 | 20 74 6f 20 6e 65 78 74 |{advance| to next|
|00002720| 20 63 6f 6c 6f 72 7d 0d | 09 09 09 09 49 46 20 49 | color}.|....IF I|
|00002730| 73 57 68 69 74 65 28 61 | 43 6f 6c 6f 72 29 20 54 |sWhite(a|Color) T|
|00002740| 48 45 4e 0d 09 09 09 09 | 09 43 79 63 6c 65 3b 20 |HEN.....|.Cycle; |
|00002750| 7b 74 68 69 73 20 6f 6e | 65 20 69 73 20 77 68 69 |{this on|e is whi|
|00002760| 74 65 2c 20 74 72 79 20 | 61 6e 6f 74 68 65 72 7d |te, try |another}|
|00002770| 0d 09 09 09 09 49 46 20 | 49 73 42 6c 61 63 6b 28 |.....IF |IsBlack(|
|00002780| 61 43 6f 6c 6f 72 29 20 | 54 48 45 4e 0d 09 09 09 |aColor) |THEN....|
|00002790| 09 09 43 79 63 6c 65 3b | 20 7b 74 68 69 73 20 6f |..Cycle;| {this o|
|000027a0| 6e 65 20 69 73 20 62 6c | 61 63 6b 2c 20 74 72 79 |ne is bl|ack, try|
|000027b0| 20 61 6e 6f 74 68 65 72 | 7d 0d 0d 09 09 7b 24 50 | another|}....{$P|
|000027c0| 55 53 48 7d 20 7b 24 52 | 2d 7d 0d 09 09 09 09 63 |USH} {$R|-}.....c|
|000027d0| 74 54 61 62 6c 65 5b 74 | 61 62 6c 65 49 6e 64 65 |tTable[t|ableInde|
|000027e0| 78 5d 2e 72 67 62 20 3a | 3d 20 61 43 6f 6c 6f 72 |x].rgb :|= aColor|
|000027f0| 3b 20 7b 75 73 65 20 74 | 68 69 73 20 63 6f 6c 6f |; {use t|his colo|
|00002800| 72 7d 0d 09 09 7b 24 50 | 4f 50 7d 0d 09 09 09 09 |r}...{$P|OP}.....|
|00002810| 74 61 62 6c 65 49 6e 64 | 65 78 20 3a 3d 20 74 61 |tableInd|ex := ta|
|00002820| 62 6c 65 49 6e 64 65 78 | 20 2b 20 31 3b 0d 09 09 |bleIndex| + 1;...|
|00002830| 09 55 4e 54 49 4c 20 74 | 61 62 6c 65 49 6e 64 65 |.UNTIL t|ableInde|
|00002840| 78 20 3e 20 63 74 53 69 | 7a 65 20 2d 20 31 3b 20 |x > ctSi|ze - 1; |
|00002850| 7b 75 6e 74 69 6c 20 74 | 68 65 20 74 61 62 6c 65 |{until t|he table|
|00002860| 20 69 73 20 66 75 6c 6c | 7d 0d 0d 09 09 09 4d 61 | is full|}.....Ma|
|00002870| 6b 65 43 6c 65 61 6e 43 | 6f 6c 6f 72 54 61 62 6c |keCleanC|olorTabl|
|00002880| 65 20 3a 3d 20 6e 6f 45 | 72 72 3b 0d 09 09 45 4e |e := noE|rr;...EN|
|00002890| 44 3b 20 7b 57 49 54 48 | 7d 0d 45 4e 44 3b 20 7b |D; {WITH|}.END; {|
|000028a0| 4d 61 6b 65 43 6c 65 61 | 6e 43 6f 6c 6f 72 54 61 |MakeClea|nColorTa|
|000028b0| 62 6c 65 7d 0d 0d 0d 0d | 50 52 4f 43 45 44 55 52 |ble}....|PROCEDUR|
|000028c0| 45 20 44 65 61 6c 6c 6f | 63 61 74 65 42 69 74 73 |E Deallo|cateBits|
|000028d0| 28 6f 66 66 73 63 72 65 | 65 6e 48 61 6e 64 6c 65 |(offscre|enHandle|
|000028e0| 3a 20 48 61 6e 64 6c 65 | 29 3b 0d 7b 47 65 74 20 |: Handle|);.{Get |
|000028f0| 72 69 64 20 6f 66 20 74 | 68 65 20 62 69 74 73 20 |rid of t|he bits |
|00002900| 66 72 6f 6d 20 61 6e 20 | 6f 66 66 2d 73 63 72 65 |from an |off-scre|
|00002910| 65 6e 20 6d 61 70 2e 7d | 0d 0d 42 45 47 49 4e 20 |en map.}|..BEGIN |
|00002920| 7b 44 65 61 6c 6c 6f 63 | 61 74 65 42 69 74 73 7d |{Dealloc|ateBits}|
|00002930| 0d 09 49 46 20 6f 66 66 | 73 63 72 65 65 6e 48 61 |..IF off|screenHa|
|00002940| 6e 64 6c 65 20 3c 3e 20 | 4e 49 4c 20 54 48 45 4e |ndle <> |NIL THEN|
|00002950| 0d 09 09 57 49 54 48 20 | 50 72 69 76 61 74 65 48 |...WITH |PrivateH|
|00002960| 61 6e 64 6c 65 28 6f 66 | 66 73 63 72 65 65 6e 48 |andle(of|fscreenH|
|00002970| 61 6e 64 6c 65 29 5e 5e | 20 44 4f 20 42 45 47 49 |andle)^^| DO BEGI|
|00002980| 4e 0d 09 09 09 49 46 20 | 4e 4f 54 20 6e 6f 74 4f |N....IF |NOT notO|
|00002990| 75 72 73 20 54 48 45 4e | 0d 09 09 09 09 44 69 73 |urs THEN|.....Dis|
|000029a0| 70 6f 73 48 61 6e 64 6c | 65 28 62 69 74 73 29 20 |posHandl|e(bits) |
|000029b0| 7b 67 65 74 20 72 69 64 | 20 6f 66 20 74 68 65 20 |{get rid| of the |
|000029c0| 62 69 74 73 7d 0d 09 09 | 09 45 4c 53 45 0d 09 09 |bits}...|.ELSE...|
|000029d0| 09 09 46 72 65 65 45 6e | 68 61 6e 63 65 64 47 42 |..FreeEn|hancedGB|
|000029e0| 75 66 66 65 72 28 50 74 | 72 28 62 69 74 73 29 29 |uffer(Pt|r(bits))|
|000029f0| 3b 0d 09 09 09 62 69 74 | 73 20 3a 3d 20 4e 49 4c |;....bit|s := NIL|
|00002a00| 3b 0d 0d 09 09 09 49 46 | 20 62 69 74 73 50 6f 72 |;.....IF| bitsPor|
|00002a10| 74 20 3c 3e 20 4e 49 4c | 20 54 48 45 4e 20 42 45 |t <> NIL| THEN BE|
|00002a20| 47 49 4e 0d 09 09 09 09 | 49 46 20 62 69 74 73 50 |GIN.....|IF bitsP|
|00002a30| 6f 72 74 5e 2e 76 69 73 | 52 67 6e 20 3c 3e 20 4e |ort^.vis|Rgn <> N|
|00002a40| 49 4c 20 54 48 45 4e 20 | 42 45 47 49 4e 20 7b 76 |IL THEN |BEGIN {v|
|00002a50| 69 73 52 67 6e 20 6f 66 | 20 4e 49 4c 20 6d 65 61 |isRgn of| NIL mea|
|00002a60| 6e 73 20 70 6f 72 74 20 | 69 73 20 6e 6f 74 20 6f |ns port |is not o|
|00002a70| 70 65 6e 20 79 65 74 7d | 0d 09 09 09 09 09 49 46 |pen yet}|......IF|
|00002a80| 20 72 65 71 75 65 73 74 | 65 64 44 65 70 74 68 20 | request|edDepth |
|00002a90| 3e 20 30 20 54 48 45 4e | 20 7b 69 66 20 77 65 20 |> 0 THEN| {if we |
|00002aa0| 63 72 65 61 74 65 64 20 | 61 20 70 72 69 76 61 74 |created |a privat|
|00002ab0| 65 20 64 65 76 69 63 65 | 20 61 6e 64 20 63 6f 6c |e device| and col|
|00002ac0| 6f 72 20 74 61 62 6c 65 | 7d 0d 09 09 09 09 09 09 |or table|}.......|
|00002ad0| 44 69 73 70 6f 73 48 61 | 6e 64 6c 65 28 48 61 6e |DisposHa|ndle(Han|
|00002ae0| 64 6c 65 28 62 69 74 73 | 50 6f 72 74 5e 2e 70 6f |dle(bits|Port^.po|
|00002af0| 72 74 50 69 78 4d 61 70 | 5e 5e 2e 70 6d 54 61 62 |rtPixMap|^^.pmTab|
|00002b00| 6c 65 29 29 3b 20 7b 67 | 65 74 20 72 69 64 20 6f |le)); {g|et rid o|
|00002b10| 66 20 74 68 65 20 63 6f | 6c 6f 72 73 7d 0d 09 09 |f the co|lors}...|
|00002b20| 09 09 09 43 6c 6f 73 65 | 50 6f 72 74 28 47 72 61 |...Close|Port(Gra|
|00002b30| 66 50 74 72 28 62 69 74 | 73 50 6f 72 74 29 29 3b |fPtr(bit|sPort));|
|00002b40| 0d 09 09 09 0d 09 09 09 | 09 44 69 73 70 6f 73 65 |........|.Dispose|
|00002b50| 52 67 6e 28 69 6e 76 61 | 6c 52 65 67 69 6f 6e 29 |Rgn(inva|lRegion)|
|00002b60| 3b 20 7b 67 65 74 20 72 | 69 64 20 6f 66 20 74 68 |; {get r|id of th|
|00002b70| 65 20 69 6e 76 61 6c 69 | 64 61 74 69 6f 6e 20 72 |e invali|dation r|
|00002b80| 65 67 69 6f 6e 7d 0d 09 | 09 09 09 45 4e 44 3b 20 |egion}..|...END; |
|00002b90| 7b 49 46 20 2e 2e 2e 62 | 69 74 73 50 6f 72 74 5e |{IF ...b|itsPort^|
|00002ba0| 2e 76 69 73 52 67 6e 20 | 3c 3e 20 4e 49 4c 7d 0d |.visRgn |<> NIL}.|
|00002bb0| 09 09 09 09 44 69 73 70 | 6f 73 50 74 72 28 50 74 |....Disp|osPtr(Pt|
|00002bc0| 72 28 62 69 74 73 50 6f | 72 74 29 29 3b 0d 09 09 |r(bitsPo|rt));...|
|00002bd0| 09 45 4e 44 3b 20 7b 49 | 46 20 62 69 74 73 50 6f |.END; {I|F bitsPo|
|00002be0| 72 74 20 3c 3e 20 4e 49 | 4c 7d 0d 09 09 09 62 69 |rt <> NI|L}....bi|
|00002bf0| 74 73 50 6f 72 74 20 3a | 3d 20 4e 49 4c 3b 0d 0d |tsPort :|= NIL;..|
|00002c00| 09 09 09 49 46 20 62 69 | 74 73 44 65 76 69 63 65 |...IF bi|tsDevice|
|00002c10| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 0d 09 09 09 | <> NIL |THEN....|
|00002c20| 09 49 46 20 72 65 71 75 | 65 73 74 65 64 44 65 70 |.IF requ|estedDep|
|00002c30| 74 68 20 3e 20 30 20 54 | 48 45 4e 20 42 45 47 49 |th > 0 T|HEN BEGI|
|00002c40| 4e 20 7b 69 66 20 77 65 | 20 63 72 65 61 74 65 64 |N {if we| created|
|00002c50| 20 61 20 70 72 69 76 61 | 74 65 20 64 65 76 69 63 | a priva|te devic|
|00002c60| 65 7d 0d 09 09 09 09 09 | 62 69 74 73 44 65 76 69 |e}......|bitsDevi|
|00002c70| 63 65 5e 5e 2e 67 64 50 | 4d 61 70 20 3a 3d 20 4e |ce^^.gdP|Map := N|
|00002c80| 49 4c 3b 20 7b 74 68 65 | 20 70 69 78 6d 61 70 20 |IL; {the| pixmap |
|00002c90| 77 61 73 20 6f 77 6e 65 | 64 20 62 79 20 74 68 65 |was owne|d by the|
|00002ca0| 20 70 6f 72 74 7d 0d 09 | 09 09 09 09 44 69 73 70 | port}..|....Disp|
|00002cb0| 6f 73 47 44 65 76 69 63 | 65 28 62 69 74 73 44 65 |osGDevic|e(bitsDe|
|00002cc0| 76 69 63 65 29 3b 0d 09 | 09 09 09 09 62 69 74 73 |vice);..|....bits|
|00002cd0| 44 65 76 69 63 65 20 3a | 3d 20 4e 49 4c 3b 0d 09 |Device :|= NIL;..|
|00002ce0| 09 09 09 45 4e 44 3b 20 | 7b 49 46 20 72 65 71 75 |...END; |{IF requ|
|00002cf0| 65 73 74 65 64 44 65 70 | 74 68 20 3e 20 30 7d 0d |estedDep|th > 0}.|
|00002d00| 09 09 45 4e 44 3b 20 7b | 57 49 54 48 7d 0d 45 4e |..END; {|WITH}.EN|
|00002d10| 44 3b 20 7b 44 65 61 6c | 6c 6f 63 61 74 65 42 69 |D; {Deal|locateBi|
|00002d20| 74 73 7d 0d 0d 0d 0d 46 | 55 4e 43 54 49 4f 4e 20 |ts}....F|UNCTION |
|00002d30| 47 65 74 4d 61 70 28 6f | 66 66 73 63 72 65 65 6e |GetMap(o|ffscreen|
|00002d40| 48 61 6e 64 6c 65 3a 20 | 48 61 6e 64 6c 65 29 3a |Handle: |Handle):|
|00002d50| 20 42 69 74 4d 61 70 50 | 74 72 3b 0d 7b 47 65 74 | BitMapP|tr;.{Get|
|00002d60| 20 61 20 42 69 74 4d 61 | 70 50 74 72 20 66 6f 72 | a BitMa|pPtr for|
|00002d70| 20 74 68 65 20 62 69 74 | 73 20 69 6e 20 74 68 65 | the bit|s in the|
|00002d80| 20 6f 66 66 73 63 72 65 | 65 6e 20 68 61 6e 64 6c | offscre|en handl|
|00002d90| 65 2e 0d 20 54 68 69 73 | 20 69 73 20 61 6c 73 6f |e.. This| is also|
|00002da0| 20 74 68 65 20 62 65 73 | 74 20 77 61 79 20 74 6f | the bes|t way to|
|00002db0| 20 73 65 65 20 69 66 20 | 74 68 65 20 62 69 74 73 | see if |the bits|
|00002dc0| 20 61 72 65 20 61 6c 6c | 6f 63 61 74 65 64 2e 0d | are all|ocated..|
|00002dd0| 20 4e 6f 74 65 20 74 68 | 61 74 20 74 68 69 73 20 | Note th|at this |
|00002de0| 68 61 73 20 61 20 73 69 | 64 65 2d 65 66 66 65 63 |has a si|de-effec|
|00002df0| 74 20 6f 66 20 73 65 74 | 74 69 6e 67 20 75 70 20 |t of set|ting up |
|00002e00| 74 68 65 20 62 61 73 65 | 41 64 64 72 20 70 72 6f |the base|Addr pro|
|00002e10| 70 65 72 6c 79 2e 7d 0d | 0d 56 41 52 0d 09 6d 61 |perly.}.|.VAR..ma|
|00002e20| 70 09 3a 20 42 69 74 4d | 61 70 50 74 72 3b 0d 0d |p.: BitM|apPtr;..|
|00002e30| 42 45 47 49 4e 20 7b 47 | 65 74 4d 61 70 7d 0d 09 |BEGIN {G|etMap}..|
|00002e40| 6d 61 70 20 3a 3d 20 4e | 49 4c 3b 0d 0d 09 49 46 |map := N|IL;...IF|
|00002e50| 20 6f 66 66 73 63 72 65 | 65 6e 48 61 6e 64 6c 65 | offscre|enHandle|
|00002e60| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 20 7b 69 66 | <> NIL |THEN {if|
|00002e70| 20 77 65 20 68 61 76 65 | 20 62 69 74 73 7d 0d 09 | we have| bits}..|
|00002e80| 09 57 49 54 48 20 50 72 | 69 76 61 74 65 48 61 6e |.WITH Pr|ivateHan|
|00002e90| 64 6c 65 28 6f 66 66 73 | 63 72 65 65 6e 48 61 6e |dle(offs|creenHan|
|00002ea0| 64 6c 65 29 5e 5e 20 44 | 4f 20 42 45 47 49 4e 0d |dle)^^ D|O BEGIN.|
|00002eb0| 09 09 09 49 46 20 62 69 | 74 73 20 3c 3e 20 4e 49 |...IF bi|ts <> NI|
|00002ec0| 4c 20 54 48 45 4e 20 7b | 69 66 20 77 65 20 73 65 |L THEN {|if we se|
|00002ed0| 65 6d 20 74 6f 20 68 61 | 76 65 20 62 69 74 73 2c |em to ha|ve bits,|
|00002ee0| 20 6d 61 6b 65 20 73 75 | 72 65 20 74 68 61 74 20 | make su|re that |
|00002ef0| 77 65 20 72 65 61 6c 6c | 79 20 64 6f 7d 0d 09 09 |we reall|y do}...|
|00002f00| 09 09 49 46 20 53 74 72 | 69 70 41 64 64 72 65 73 |..IF Str|ipAddres|
|00002f10| 73 28 62 69 74 73 5e 29 | 20 3d 20 4e 49 4c 20 54 |s(bits^)| = NIL T|
|00002f20| 48 45 4e 0d 09 09 09 09 | 09 44 65 61 6c 6c 6f 63 |HEN.....|.Dealloc|
|00002f30| 61 74 65 42 69 74 73 28 | 6f 66 66 73 63 72 65 65 |ateBits(|offscree|
|00002f40| 6e 48 61 6e 64 6c 65 29 | 0d 09 09 09 09 45 4c 53 |nHandle)|.....ELS|
|00002f50| 45 20 42 45 47 49 4e 0d | 09 09 09 09 09 7b 66 69 |E BEGIN.|.....{fi|
|00002f60| 6e 64 20 74 68 65 20 6d | 61 70 7d 0d 09 09 09 09 |nd the m|ap}.....|
|00002f70| 09 57 49 54 48 20 62 69 | 74 73 50 6f 72 74 5e 20 |.WITH bi|tsPort^ |
|00002f80| 44 4f 0d 09 09 09 09 09 | 09 49 46 20 70 6f 72 74 |DO......|.IF port|
|00002f90| 56 65 72 73 69 6f 6e 20 | 3e 20 30 20 54 48 45 4e |Version |> 0 THEN|
|00002fa0| 20 7b 6f 6c 64 2d 73 74 | 79 6c 65 20 70 6f 72 74 | {old-st|yle port|
|00002fb0| 3f 7d 0d 09 09 09 09 09 | 09 09 6d 61 70 20 3a 3d |?}......|..map :=|
|00002fc0| 20 40 70 6f 72 74 50 69 | 78 4d 61 70 20 7b 74 68 | @portPi|xMap {th|
|00002fd0| 69 73 20 69 73 20 72 65 | 61 6c 6c 79 20 70 6f 72 |is is re|ally por|
|00002fe0| 74 42 69 74 73 21 7d 0d | 09 09 09 09 09 09 45 4c |tBits!}.|......EL|
|00002ff0| 53 45 0d 09 09 09 09 09 | 09 09 6d 61 70 20 3a 3d |SE......|..map :=|
|00003000| 20 42 69 74 4d 61 70 50 | 74 72 28 70 6f 72 74 50 | BitMapP|tr(portP|
|00003010| 69 78 4d 61 70 5e 29 3b | 0d 09 09 09 09 09 49 46 |ixMap^);|......IF|
|00003020| 20 6e 6f 74 4f 75 72 73 | 20 54 48 45 4e 0d 09 09 | notOurs| THEN...|
|00003030| 09 09 09 09 6d 61 70 5e | 2e 62 61 73 65 41 64 64 |....map^|.baseAdd|
|00003040| 72 20 3a 3d 20 50 74 72 | 28 62 69 74 73 29 0d 09 |r := Ptr|(bits)..|
|00003050| 09 09 09 09 45 4c 53 45 | 0d 09 09 09 09 09 09 6d |....ELSE|.......m|
|00003060| 61 70 5e 2e 62 61 73 65 | 41 64 64 72 20 3a 3d 20 |ap^.base|Addr := |
|00003070| 62 69 74 73 5e 3b 0d 09 | 09 09 09 45 4e 44 3b 20 |bits^;..|...END; |
|00003080| 7b 45 4c 53 45 7d 0d 09 | 09 45 4e 44 3b 20 7b 57 |{ELSE}..|.END; {W|
|00003090| 49 54 48 7d 0d 09 47 65 | 74 4d 61 70 20 3a 3d 20 |ITH}..Ge|tMap := |
|000030a0| 6d 61 70 3b 0d 45 4e 44 | 3b 20 7b 47 65 74 4d 61 |map;.END|; {GetMa|
|000030b0| 70 7d 0d 0d 0d 0d 46 55 | 4e 43 54 49 4f 4e 20 47 |p}....FU|NCTION G|
|000030c0| 65 74 42 69 74 73 48 61 | 6e 64 6c 65 28 6f 66 66 |etBitsHa|ndle(off|
|000030d0| 73 63 72 65 65 6e 48 61 | 6e 64 6c 65 3a 20 48 61 |screenHa|ndle: Ha|
|000030e0| 6e 64 6c 65 29 3a 20 48 | 61 6e 64 6c 65 3b 0d 42 |ndle): H|andle;.B|
|000030f0| 45 47 49 4e 0d 09 47 65 | 74 42 69 74 73 48 61 6e |EGIN..Ge|tBitsHan|
|00003100| 64 6c 65 20 3a 3d 20 4e | 49 4c 3b 0d 09 49 46 20 |dle := N|IL;..IF |
|00003110| 6f 66 66 73 63 72 65 65 | 6e 48 61 6e 64 6c 65 20 |offscree|nHandle |
|00003120| 3c 3e 20 4e 49 4c 20 54 | 48 45 4e 0d 09 09 57 49 |<> NIL T|HEN...WI|
|00003130| 54 48 20 50 72 69 76 61 | 74 65 48 61 6e 64 6c 65 |TH Priva|teHandle|
|00003140| 28 6f 66 66 73 63 72 65 | 65 6e 48 61 6e 64 6c 65 |(offscre|enHandle|
|00003150| 29 5e 5e 20 44 4f 0d 09 | 09 09 49 46 20 4e 4f 54 |)^^ DO..|..IF NOT|
|00003160| 20 6e 6f 74 4f 75 72 73 | 20 54 48 45 4e 0d 09 09 | notOurs| THEN...|
|00003170| 09 09 47 65 74 42 69 74 | 73 48 61 6e 64 6c 65 20 |..GetBit|sHandle |
|00003180| 3a 3d 20 62 69 74 73 3b | 0d 45 4e 44 3b 20 7b 47 |:= bits;|.END; {G|
|00003190| 65 74 42 69 74 73 48 61 | 6e 64 6c 65 7d 0d 0d 0d |etBitsHa|ndle}...|
|000031a0| 0d 46 55 4e 43 54 49 4f | 4e 20 41 6c 6c 6f 63 61 |.FUNCTIO|N Alloca|
|000031b0| 74 65 42 69 74 73 28 6f | 66 66 73 63 72 65 65 6e |teBits(o|ffscreen|
|000031c0| 48 61 6e 64 6c 65 3a 20 | 48 61 6e 64 6c 65 3b 20 |Handle: |Handle; |
|000031d0| 56 41 52 20 62 75 66 66 | 4e 6f 74 4e 65 65 64 65 |VAR buff|NotNeede|
|000031e0| 64 3a 20 42 4f 4f 4c 45 | 41 4e 29 3a 20 4f 53 45 |d: BOOLE|AN): OSE|
|000031f0| 72 72 3b 0d 7b 41 6c 6c | 6f 63 61 74 65 20 74 68 |rr;.{All|ocate th|
|00003200| 65 20 62 69 74 73 2c 20 | 70 6f 72 74 2c 20 64 65 |e bits, |port, de|
|00003210| 76 69 63 65 2c 20 65 74 | 63 2e 20 66 6f 72 20 74 |vice, et|c. for t|
|00003220| 68 65 20 6f 66 66 2d 73 | 63 72 65 65 6e 20 6d 61 |he off-s|creen ma|
|00003230| 70 2e 0d 20 49 66 20 61 | 6e 20 65 72 72 6f 72 20 |p.. If a|n error |
|00003240| 63 6f 64 65 20 69 73 20 | 72 65 74 75 72 6e 65 64 |code is |returned|
|00003250| 2c 20 74 68 65 20 68 61 | 6e 64 6c 65 20 77 69 6c |, the ha|ndle wil|
|00003260| 6c 20 62 65 20 69 6e 20 | 74 68 65 20 22 64 6f 72 |l be in |the "dor|
|00003270| 6d 61 6e 74 22 20 73 74 | 61 67 65 2e 20 3f 3f 3f |mant" st|age. ???|
|00003280| 20 64 65 66 69 6e 65 0d | 20 49 66 20 74 68 65 20 | define.| If the |
|00003290| 62 69 74 73 20 61 72 65 | 20 61 6c 72 65 61 64 79 |bits are| already|
|000032a0| 20 61 6c 6c 6f 63 61 74 | 65 64 2c 20 74 68 65 6e | allocat|ed, then|
|000032b0| 20 6e 6f 74 68 69 6e 67 | 20 77 69 6c 6c 20 68 61 | nothing| will ha|
|000032c0| 70 70 65 6e 2e 7d 0d 0d | 56 41 52 0d 09 6f 6c 64 |ppen.}..|VAR..old|
|000032d0| 50 6f 72 74 09 09 09 09 | 3a 20 47 72 61 66 50 74 |Port....|: GrafPt|
|000032e0| 72 3b 0d 09 62 6f 75 6e | 64 65 72 09 09 09 09 3a |r;..boun|der....:|
|000032f0| 20 52 65 63 74 3b 0d 09 | 6d 61 70 09 09 09 09 09 | Rect;..|map.....|
|00003300| 3a 20 42 69 74 4d 61 70 | 50 74 72 3b 0d 09 62 69 |: BitMap|Ptr;..bi|
|00003310| 74 73 53 69 7a 65 09 09 | 09 3a 20 4c 4f 4e 47 49 |tsSize..|.: LONGI|
|00003320| 4e 54 3b 0d 09 63 6f 6c | 6f 72 73 09 09 09 09 3a |NT;..col|ors....:|
|00003330| 20 43 54 61 62 48 61 6e | 64 6c 65 3b 0d 09 70 72 | CTabHan|dle;..pr|
|00003340| 65 66 65 72 72 65 64 52 | 65 73 6f 6c 75 74 69 6f |eferredR|esolutio|
|00003350| 6e 09 3a 20 49 4e 54 45 | 47 45 52 3b 0d 09 69 6e |n.: INTE|GER;..in|
|00003360| 76 65 72 73 65 54 61 62 | 6c 65 09 09 3a 20 49 54 |verseTab|le..: IT|
|00003370| 61 62 48 61 6e 64 6c 65 | 3b 0d 09 74 6f 74 61 6c |abHandle|;..total|
|00003380| 53 70 61 63 65 09 09 09 | 3a 20 4c 4f 4e 47 49 4e |Space...|: LONGIN|
|00003390| 54 3b 0d 09 63 6f 6e 74 | 69 67 75 6f 75 73 53 70 |T;..cont|iguousSp|
|000033a0| 61 63 65 09 09 3a 20 4c | 4f 4e 47 49 4e 54 3b 0d |ace..: L|ONGINT;.|
|000033b0| 09 75 73 65 33 32 42 69 | 74 73 09 09 09 3a 20 42 |.use32Bi|ts...: B|
|000033c0| 4f 4f 4c 45 41 4e 3b 0d | 0d 09 50 52 4f 43 45 44 |OOLEAN;.|..PROCED|
|000033d0| 55 52 45 20 4f 75 74 28 | 65 72 72 6f 72 3a 20 4f |URE Out(|error: O|
|000033e0| 53 45 72 72 29 3b 0d 09 | 42 45 47 49 4e 20 7b 4f |SErr);..|BEGIN {O|
|000033f0| 75 74 7d 0d 09 09 49 46 | 20 65 72 72 6f 72 20 3c |ut}...IF| error <|
|00003400| 3e 20 6e 6f 45 72 72 20 | 54 48 45 4e 20 42 45 47 |> noErr |THEN BEG|
|00003410| 49 4e 0d 09 09 09 48 55 | 6e 6c 6f 63 6b 28 6f 66 |IN....HU|nlock(of|
|00003420| 66 73 63 72 65 65 6e 48 | 61 6e 64 6c 65 29 3b 0d |fscreenH|andle);.|
|00003430| 09 09 09 44 65 61 6c 6c | 6f 63 61 74 65 42 69 74 |...Deall|ocateBit|
|00003440| 73 28 6f 66 66 73 63 72 | 65 65 6e 48 61 6e 64 6c |s(offscr|eenHandl|
|00003450| 65 29 3b 0d 09 09 09 53 | 65 74 50 6f 72 74 28 6f |e);....S|etPort(o|
|00003460| 6c 64 50 6f 72 74 29 3b | 0d 09 09 09 41 6c 6c 6f |ldPort);|....Allo|
|00003470| 63 61 74 65 42 69 74 73 | 20 3a 3d 20 65 72 72 6f |cateBits| := erro|
|00003480| 72 3b 0d 09 09 09 45 58 | 49 54 28 41 6c 6c 6f 63 |r;....EX|IT(Alloc|
|00003490| 61 74 65 42 69 74 73 29 | 3b 0d 09 09 45 4e 44 3b |ateBits)|;...END;|
|000034a0| 20 7b 49 46 20 65 72 72 | 6f 72 20 3c 3e 20 6e 6f | {IF err|or <> no|
|000034b0| 45 72 72 7d 0d 09 45 4e | 44 3b 20 7b 4f 75 74 7d |Err}..EN|D; {Out}|
|000034c0| 0d 0d 42 45 47 49 4e 20 | 7b 41 6c 6c 6f 63 61 74 |..BEGIN |{Allocat|
|000034d0| 65 42 69 74 73 7d 0d 09 | 49 46 20 6f 66 66 73 63 |eBits}..|IF offsc|
|000034e0| 72 65 65 6e 48 61 6e 64 | 6c 65 20 3c 3e 20 4e 49 |reenHand|le <> NI|
|000034f0| 4c 20 54 48 45 4e 0d 09 | 09 49 46 20 47 65 74 4d |L THEN..|.IF GetM|
|00003500| 61 70 28 6f 66 66 73 63 | 72 65 65 6e 48 61 6e 64 |ap(offsc|reenHand|
|00003510| 6c 65 29 20 3d 20 4e 49 | 4c 20 54 48 45 4e 20 42 |le) = NI|L THEN B|
|00003520| 45 47 49 4e 20 7b 69 66 | 20 74 68 65 20 62 69 74 |EGIN {if| the bit|
|00003530| 73 20 61 72 65 20 6e 6f | 74 20 61 6c 72 65 61 64 |s are no|t alread|
|00003540| 79 20 61 6c 6c 6f 63 61 | 74 65 64 7d 0d 09 09 09 |y alloca|ted}....|
|00003550| 47 65 74 50 6f 72 74 28 | 6f 6c 64 50 6f 72 74 29 |GetPort(|oldPort)|
|00003560| 3b 0d 0d 09 09 09 4d 6f | 76 65 48 48 69 28 6f 66 |;.....Mo|veHHi(of|
|00003570| 66 73 63 72 65 65 6e 48 | 61 6e 64 6c 65 29 3b 20 |fscreenH|andle); |
|00003580| 7b 66 6c 79 20 74 68 65 | 20 68 61 6e 64 6c 65 20 |{fly the| handle |
|00003590| 68 69 67 68 20 69 6e 20 | 74 68 65 20 68 65 61 70 |high in |the heap|
|000035a0| 20 73 69 6e 63 65 20 77 | 65 20 6c 6f 63 6b 20 69 | since w|e lock i|
|000035b0| 74 20 64 6f 77 6e 7d 0d | 09 09 09 48 4c 6f 63 6b |t down}.|...HLock|
|000035c0| 28 6f 66 66 73 63 72 65 | 65 6e 48 61 6e 64 6c 65 |(offscre|enHandle|
|000035d0| 29 3b 0d 09 09 09 57 49 | 54 48 20 50 72 69 76 61 |);....WI|TH Priva|
|000035e0| 74 65 48 61 6e 64 6c 65 | 28 6f 66 66 73 63 72 65 |teHandle|(offscre|
|000035f0| 65 6e 48 61 6e 64 6c 65 | 29 5e 5e 20 44 4f 20 42 |enHandle|)^^ DO B|
|00003600| 45 47 49 4e 0d 09 09 09 | 09 62 69 74 73 50 6f 72 |EGIN....|.bitsPor|
|00003610| 74 20 3a 3d 20 43 47 72 | 61 66 50 74 72 28 4e 65 |t := CGr|afPtr(Ne|
|00003620| 77 50 74 72 43 6c 65 61 | 72 28 53 49 5a 45 4f 46 |wPtrClea|r(SIZEOF|
|00003630| 28 47 72 61 66 50 6f 72 | 74 29 29 29 3b 20 7b 63 |(GrafPor|t))); {c|
|00003640| 72 65 61 74 65 20 61 20 | 6e 65 77 20 70 6f 72 74 |reate a |new port|
|00003650| 7d 0d 09 09 09 09 7b 4e | 65 77 50 74 72 43 6c 65 |}.....{N|ewPtrCle|
|00003660| 61 72 20 6d 65 61 6e 73 | 20 74 68 61 74 20 62 69 |ar means| that bi|
|00003670| 74 73 20 3a 3d 20 4e 49 | 4c 2c 20 69 6e 76 61 6c |ts := NI|L, inval|
|00003680| 52 65 67 69 6f 6e 20 3a | 3d 20 4e 49 4c 2c 20 6e |Region :|= NIL, n|
|00003690| 6f 74 4f 75 72 73 20 3a | 3d 20 46 41 4c 53 45 2c |otOurs :|= FALSE,|
|000036a0| 20 65 74 63 2e 7d 0d 09 | 09 09 09 4f 75 74 28 4d | etc.}..|...Out(M|
|000036b0| 65 6d 45 72 72 6f 72 29 | 3b 0d 0d 09 09 09 09 57 |emError)|;......W|
|000036c0| 49 54 48 20 72 65 71 75 | 65 73 74 65 64 42 6f 75 |ITH requ|estedBou|
|000036d0| 6e 64 73 20 44 4f 0d 09 | 09 09 09 09 53 65 74 52 |nds DO..|....SetR|
|000036e0| 65 63 74 28 62 6f 75 6e | 64 65 72 2c 20 30 2c 20 |ect(boun|der, 0, |
|000036f0| 30 2c 20 72 69 67 68 74 | 20 2d 20 6c 65 66 74 2c |0, right| - left,|
|00003700| 20 62 6f 74 74 6f 6d 20 | 2d 20 74 6f 70 29 3b 0d | bottom |- top);.|
|00003710| 0d 09 09 09 09 49 46 20 | 74 68 65 4d 61 63 2e 68 |.....IF |theMac.h|
|00003720| 61 73 43 6f 6c 6f 72 51 | 44 20 54 48 45 4e 0d 09 |asColorQ|D THEN..|
|00003730| 09 09 09 09 57 49 54 48 | 20 62 69 74 73 50 6f 72 |....WITH| bitsPor|
|00003740| 74 5e 20 44 4f 20 42 45 | 47 49 4e 0d 09 09 09 09 |t^ DO BE|GIN.....|
|00003750| 09 09 4f 70 65 6e 43 50 | 6f 72 74 28 62 69 74 73 |..OpenCP|ort(bits|
|00003760| 50 6f 72 74 29 3b 20 7b | 61 6c 77 61 79 73 20 75 |Port); {|always u|
|00003770| 73 65 20 61 20 63 6f 6c | 6f 72 20 70 6f 72 74 7d |se a col|or port}|
|00003780| 0d 09 09 09 09 09 09 70 | 6f 72 74 50 69 78 4d 61 |.......p|ortPixMa|
|00003790| 70 5e 5e 2e 70 6d 54 61 | 62 6c 65 20 3a 3d 20 4e |p^^.pmTa|ble := N|
|000037a0| 49 4c 3b 20 7b 69 6e 20 | 63 61 73 65 20 77 65 20 |IL; {in |case we |
|000037b0| 66 61 69 6c 20 62 65 66 | 6f 72 65 20 77 65 20 6d |fail bef|ore we m|
|000037c0| 61 6b 65 20 61 20 63 6f | 6c 6f 72 20 74 61 62 6c |ake a co|lor tabl|
|000037d0| 65 7d 0d 09 09 09 09 09 | 09 0d 09 09 09 09 09 09 |e}......|........|
|000037e0| 49 46 20 72 65 71 75 65 | 73 74 65 64 44 65 70 74 |IF reque|stedDept|
|000037f0| 68 20 3e 20 30 20 54 48 | 45 4e 20 42 45 47 49 4e |h > 0 TH|EN BEGIN|
|00003800| 20 7b 69 66 20 74 68 65 | 72 65 20 69 73 20 61 20 | {if the|re is a |
|00003810| 70 72 69 76 61 74 65 20 | 64 65 76 69 63 65 7d 0d |private |device}.|
|00003820| 09 09 09 09 09 09 09 7b | 6d 61 6b 65 20 61 20 63 |.......{|make a c|
|00003830| 6f 6c 6f 72 20 74 61 62 | 6c 65 20 66 72 6f 6d 20 |olor tab|le from |
|00003840| 74 68 65 20 72 65 71 75 | 65 73 74 65 64 20 63 6f |the requ|ested co|
|00003850| 6c 6f 72 73 20 6f 72 20 | 61 20 72 65 73 6f 75 72 |lors or |a resour|
|00003860| 63 65 20 66 69 6c 65 20 | 6f 72 20 52 4f 4d 7d 0d |ce file |or ROM}.|
|00003870| 09 09 09 09 09 09 09 4f | 75 74 28 4d 61 6b 65 43 |.......O|ut(MakeC|
|00003880| 6c 65 61 6e 43 6f 6c 6f | 72 54 61 62 6c 65 28 72 |leanColo|rTable(r|
|00003890| 65 71 75 65 73 74 65 64 | 43 6f 6c 6f 72 73 2c 20 |equested|Colors, |
|000038a0| 72 65 71 75 65 73 74 65 | 64 44 65 70 74 68 2c 20 |requeste|dDepth, |
|000038b0| 63 6f 6c 6f 72 73 29 29 | 3b 0d 09 09 09 09 09 09 |colors))|;.......|
|000038c0| 09 0d 09 09 09 09 09 09 | 09 7b 6e 6f 77 20 73 65 |........|.{now se|
|000038d0| 74 20 75 70 20 74 68 65 | 20 70 69 78 6d 61 70 20 |t up the| pixmap |
|000038e0| 6f 66 20 74 68 65 20 70 | 6f 72 74 7d 0d 09 09 09 |of the p|ort}....|
|000038f0| 09 09 09 09 49 6e 69 74 | 47 42 75 66 66 65 72 50 |....Init|GBufferP|
|00003900| 69 78 6d 61 70 28 70 6f | 72 74 50 69 78 4d 61 70 |ixmap(po|rtPixMap|
|00003910| 2c 20 62 6f 75 6e 64 65 | 72 2c 20 63 68 75 6e 6b |, bounde|r, chunk|
|00003920| 79 2c 20 72 65 71 75 65 | 73 74 65 64 44 65 70 74 |y, reque|stedDept|
|00003930| 68 2c 20 31 2c 20 72 65 | 71 75 65 73 74 65 64 44 |h, 1, re|questedD|
|00003940| 65 70 74 68 2c 0d 09 09 | 09 09 09 09 09 09 63 6f |epth,...|......co|
|00003950| 6c 6f 72 73 2c 20 7b 72 | 65 74 75 72 6e 73 7d 20 |lors, {r|eturns} |
|00003960| 62 69 74 73 53 69 7a 65 | 29 3b 0d 09 09 0d 09 09 |bitsSize|);......|
|00003970| 09 09 09 09 09 7b 6d 61 | 6b 65 20 61 20 70 72 69 |.....{ma|ke a pri|
|00003980| 76 61 74 65 20 64 65 76 | 69 63 65 7d 0d 09 09 09 |vate dev|ice}....|
|00003990| 09 09 09 09 62 69 74 73 | 44 65 76 69 63 65 20 3a |....bits|Device :|
|000039a0| 3d 20 47 44 48 61 6e 64 | 6c 65 28 4e 65 77 48 61 |= GDHand|le(NewHa|
|000039b0| 6e 64 6c 65 43 6c 65 61 | 72 28 53 49 5a 45 4f 46 |ndleClea|r(SIZEOF|
|000039c0| 28 47 44 65 76 69 63 65 | 29 29 29 3b 0d 09 09 09 |(GDevice|)));....|
|000039d0| 09 09 09 09 4f 75 74 28 | 4d 65 6d 45 72 72 6f 72 |....Out(|MemError|
|000039e0| 29 3b 20 7b 6d 75 73 74 | 20 68 61 76 65 20 66 61 |); {must| have fa|
|000039f0| 69 6c 65 64 20 62 65 63 | 61 75 73 65 20 6f 66 20 |iled bec|ause of |
|00003a00| 68 65 61 70 20 70 61 75 | 63 69 74 79 7d 0d 09 09 |heap pau|city}...|
|00003a10| 0d 09 09 09 09 09 09 09 | 69 6e 76 65 72 73 65 54 |........|inverseT|
|00003a20| 61 62 6c 65 20 3a 3d 20 | 49 54 61 62 48 61 6e 64 |able := |ITabHand|
|00003a30| 6c 65 28 4e 65 77 48 61 | 6e 64 6c 65 28 30 29 29 |le(NewHa|ndle(0))|
|00003a40| 3b 20 7b 63 72 65 61 74 | 65 20 74 68 65 20 69 6e |; {creat|e the in|
|00003a50| 76 65 72 73 65 20 74 61 | 62 6c 65 7d 0d 09 09 09 |verse ta|ble}....|
|00003a60| 09 09 09 09 4f 75 74 28 | 4d 65 6d 45 72 72 6f 72 |....Out(|MemError|
|00003a70| 29 3b 0d 09 09 09 09 09 | 09 09 70 72 65 66 65 72 |);......|..prefer|
|00003a80| 72 65 64 52 65 73 6f 6c | 75 74 69 6f 6e 20 3a 3d |redResol|ution :=|
|00003a90| 20 47 65 74 4d 61 69 6e | 44 65 76 69 63 65 5e 5e | GetMain|Device^^|
|00003aa0| 2e 67 64 52 65 73 50 72 | 65 66 3b 20 7b 70 72 65 |.gdResPr|ef; {pre|
|00003ab0| 66 65 72 72 65 64 20 72 | 65 73 6f 6c 75 74 69 6f |ferred r|esolutio|
|00003ac0| 6e 20 3f 3f 3f 20 69 73 | 20 74 68 69 73 20 63 6f |n ??? is| this co|
|00003ad0| 6f 6c 3f 7d 0d 09 09 0d | 09 09 09 09 09 09 09 57 |ol?}....|.......W|
|00003ae0| 49 54 48 20 62 69 74 73 | 44 65 76 69 63 65 5e 5e |ITH bits|Device^^|
|00003af0| 20 44 4f 20 42 45 47 49 | 4e 20 7b 73 65 74 20 75 | DO BEGI|N {set u|
|00003b00| 70 20 74 68 65 20 6f 74 | 68 65 72 20 66 69 65 6c |p the ot|her fiel|
|00003b10| 64 73 20 6f 66 20 74 68 | 65 20 64 65 76 69 63 65 |ds of th|e device|
|00003b20| 7d 0d 09 09 09 09 09 09 | 09 09 67 64 54 79 70 65 |}.......|..gdType|
|00003b30| 20 3a 3d 20 63 6c 75 74 | 54 79 70 65 3b 0d 09 09 | := clut|Type;...|
|00003b40| 09 09 09 09 09 09 67 64 | 49 54 61 62 6c 65 20 3a |......gd|ITable :|
|00003b50| 3d 20 69 6e 76 65 72 73 | 65 54 61 62 6c 65 3b 0d |= invers|eTable;.|
|00003b60| 09 09 09 09 09 09 09 09 | 67 64 52 65 73 50 72 65 |........|gdResPre|
|00003b70| 66 20 3a 3d 20 70 72 65 | 66 65 72 72 65 64 52 65 |f := pre|ferredRe|
|00003b80| 73 6f 6c 75 74 69 6f 6e | 3b 0d 09 09 09 09 09 09 |solution|;.......|
|00003b90| 09 09 67 64 46 6c 61 67 | 73 20 3a 3d 20 32 20 2a |..gdFlag|s := 2 *|
|00003ba0| 2a 20 6e 6f 44 72 69 76 | 65 72 3b 0d 09 09 09 09 |* noDriv|er;.....|
|00003bb0| 09 09 09 09 67 64 50 4d | 61 70 20 3a 3d 20 70 6f |....gdPM|ap := po|
|00003bc0| 72 74 50 69 78 4d 61 70 | 3b 0d 09 09 09 09 09 09 |rtPixMap|;.......|
|00003bd0| 09 45 4e 44 3b 20 7b 57 | 49 54 48 7d 0d 09 09 09 |.END; {W|ITH}....|
|00003be0| 09 09 09 09 49 6e 69 74 | 47 44 65 76 69 63 65 28 |....Init|GDevice(|
|00003bf0| 30 2c 20 2d 31 2c 20 62 | 69 74 73 44 65 76 69 63 |0, -1, b|itsDevic|
|00003c00| 65 29 3b 20 7b 73 65 74 | 73 20 67 64 52 65 63 74 |e); {set|s gdRect|
|00003c10| 20 66 72 6f 6d 20 70 69 | 78 6d 61 70 20 6e 6f 77 | from pi|xmap now|
|00003c20| 3b 20 69 6e 20 66 75 74 | 75 72 65 20 6d 61 79 20 |; in fut|ure may |
|00003c30| 64 6f 20 6d 6f 72 65 7d | 0d 09 09 09 09 09 09 09 |do more}|........|
|00003c40| 4d 61 6b 65 49 54 61 62 | 6c 65 28 63 6f 6c 6f 72 |MakeITab|le(color|
|00003c50| 73 2c 20 69 6e 76 65 72 | 73 65 54 61 62 6c 65 2c |s, inver|seTable,|
|00003c60| 20 70 72 65 66 65 72 72 | 65 64 52 65 73 6f 6c 75 | preferr|edResolu|
|00003c70| 74 69 6f 6e 29 3b 0d 09 | 09 09 09 09 09 09 4f 75 |tion);..|......Ou|
|00003c80| 74 28 51 44 45 72 72 6f | 72 29 3b 20 7b 4d 61 6b |t(QDErro|r); {Mak|
|00003c90| 65 49 54 61 62 6c 65 20 | 66 61 69 6c 65 64 7d 0d |eITable |failed}.|
|00003ca0| 09 09 09 09 09 09 45 4e | 44 20 45 4c 53 45 20 42 |......EN|D ELSE B|
|00003cb0| 45 47 49 4e 20 7b 77 68 | 65 6e 20 74 68 65 72 65 |EGIN {wh|en there|
|00003cc0| 20 69 73 20 6e 6f 20 70 | 72 69 76 61 74 65 20 64 | is no p|rivate d|
|00003cd0| 65 76 69 63 65 7d 0d 09 | 09 09 09 09 09 09 09 7b |evice}..|.......{|
|00003ce0| 67 65 74 20 74 68 65 20 | 6d 61 78 2e 20 61 72 65 |get the |max. are|
|00003cf0| 61 20 64 65 76 69 63 65 | 20 61 6e 64 20 73 65 74 |a device| and set|
|00003d00| 20 75 70 20 74 68 65 20 | 70 6f 72 74 d5 73 20 70 | up the |port.s p|
|00003d10| 69 78 6d 61 70 20 61 63 | 63 6f 72 64 69 6e 67 6c |ixmap ac|cordingl|
|00003d20| 79 7d 0d 09 09 09 09 09 | 09 09 09 49 46 20 4e 4f |y}......|...IF NO|
|00003d30| 54 20 49 6e 69 74 47 42 | 75 66 66 65 72 53 63 72 |T InitGB|ufferScr|
|00003d40| 65 65 6e 28 70 6f 72 74 | 50 69 78 4d 61 70 2c 20 |een(port|PixMap, |
|00003d50| 72 65 71 75 65 73 74 65 | 64 42 6f 75 6e 64 73 2c |requeste|dBounds,|
|00003d60| 20 62 69 74 73 44 65 76 | 69 63 65 2c 20 7b 72 65 | bitsDev|ice, {re|
|00003d70| 74 75 72 6e 73 7d 20 62 | 69 74 73 53 69 7a 65 29 |turns} b|itsSize)|
|00003d80| 20 54 48 45 4e 0d 09 09 | 09 09 09 09 09 09 09 4f | THEN...|.......O|
|00003d90| 75 74 28 6e 6f 44 65 76 | 69 63 65 49 6e 74 65 72 |ut(noDev|iceInter|
|00003da0| 73 65 63 74 45 72 72 29 | 3b 20 7b 6e 6f 20 64 65 |sectErr)|; {no de|
|00003db0| 76 69 63 65 73 20 69 6e | 74 65 72 73 65 63 74 20 |vices in|tersect |
|00003dc0| 62 6f 75 6e 64 73 7d 0d | 09 09 09 09 09 09 09 09 |bounds}.|........|
|00003dd0| 09 0d 09 09 09 09 09 09 | 09 09 6f 6c 64 53 65 65 |........|..oldSee|
|00003de0| 64 20 3a 3d 20 70 6f 72 | 74 50 69 78 4d 61 70 5e |d := por|tPixMap^|
|00003df0| 5e 2e 70 6d 54 61 62 6c | 65 5e 5e 2e 63 74 53 65 |^.pmTabl|e^^.ctSe|
|00003e00| 65 64 3b 20 7b 75 73 65 | 64 20 74 6f 20 64 65 74 |ed; {use|d to det|
|00003e10| 65 63 74 20 63 6f 6c 6f | 72 20 75 70 64 61 74 65 |ect colo|r update|
|00003e20| 73 7d 0d 09 09 09 09 09 | 09 45 4e 44 3b 0d 09 09 |s}......|.END;...|
|00003e30| 09 09 09 09 0d 09 09 09 | 09 09 6d 61 70 20 3a 3d |........|..map :=|
|00003e40| 20 42 69 74 4d 61 70 50 | 74 72 28 70 6f 72 74 50 | BitMapP|tr(portP|
|00003e50| 69 78 4d 61 70 5e 29 3b | 20 7b 70 6f 69 6e 74 20 |ixMap^);| {point |
|00003e60| 74 6f 20 74 68 65 20 6d | 61 70 20 73 6f 20 77 65 |to the m|ap so we|
|00003e70| 20 63 61 6e 20 73 65 74 | 20 74 68 65 20 70 6f 72 | can set| the por|
|00003e80| 74 52 65 63 74 20 26 20 | 76 69 73 52 67 6e 7d 0d |tRect & |visRgn}.|
|00003e90| 0d 7b 21 21 21 20 3f 3f | 3f 20 44 6f 20 77 65 20 |.{!!! ??|? Do we |
|00003ea0| 6e 65 65 64 20 74 6f 20 | 63 61 6c 6c 20 46 6f 72 |need to |call For|
|00003eb0| 65 43 6f 6c 6f 72 20 61 | 6e 64 20 42 61 63 6b 43 |eColor a|nd BackC|
|00003ec0| 6f 6c 6f 72 20 6f 6e 20 | 74 68 65 20 43 47 72 61 |olor on |the CGra|
|00003ed0| 66 50 6f 72 74 20 74 6f | 20 73 65 74 20 69 74 20 |fPort to| set it |
|00003ee0| 75 70 20 72 69 67 68 74 | 3f 7d 0d 0d 09 09 09 09 |up right|?}......|
|00003ef0| 09 45 4e 44 20 7b 57 49 | 54 48 7d 0d 09 09 09 09 |.END {WI|TH}.....|
|00003f00| 45 4c 53 45 20 42 45 47 | 49 4e 20 7b 43 6c 61 73 |ELSE BEG|IN {Clas|
|00003f10| 73 69 63 20 51 75 69 63 | 6b 44 72 61 77 7d 0d 09 |sic Quic|kDraw}..|
|00003f20| 09 09 09 09 4f 70 65 6e | 50 6f 72 74 28 47 72 61 |....Open|Port(Gra|
|00003f30| 66 50 74 72 28 62 69 74 | 73 50 6f 72 74 29 29 3b |fPtr(bit|sPort));|
|00003f40| 0d 09 09 09 09 09 57 49 | 54 48 20 47 72 61 66 50 |......WI|TH GrafP|
|00003f50| 74 72 28 62 69 74 73 50 | 6f 72 74 29 5e 2c 20 70 |tr(bitsP|ort)^, p|
|00003f60| 6f 72 74 42 69 74 73 20 | 44 4f 20 42 45 47 49 4e |ortBits |DO BEGIN|
|00003f70| 0d 09 09 09 09 09 09 62 | 6f 75 6e 64 73 20 3a 3d |.......b|ounds :=|
|00003f80| 20 62 6f 75 6e 64 65 72 | 3b 0d 09 09 09 09 09 09 | bounder|;.......|
|00003f90| 7b 66 69 67 75 72 65 20 | 6f 75 74 20 68 6f 77 20 |{figure |out how |
|00003fa0| 6d 75 63 68 20 73 70 61 | 63 65 20 77 65 20 6e 65 |much spa|ce we ne|
|00003fb0| 65 64 20 66 6f 72 20 6f | 75 72 20 62 69 74 73 7d |ed for o|ur bits}|
|00003fc0| 0d 09 09 09 09 09 09 57 | 49 54 48 20 62 6f 75 6e |.......W|ITH boun|
|00003fd0| 64 73 20 44 4f 20 42 45 | 47 49 4e 0d 09 09 09 09 |ds DO BE|GIN.....|
|00003fe0| 09 09 09 72 6f 77 42 79 | 74 65 73 20 3a 3d 20 28 |...rowBy|tes := (|
|00003ff0| 28 72 69 67 68 74 20 2b | 20 31 35 29 20 44 49 56 |(right +| 15) DIV|
|00004000| 20 31 36 29 20 2a 20 32 | 3b 0d 09 09 09 09 09 09 | 16) * 2|;.......|
|00004010| 09 7b 63 61 6c 63 75 6c | 61 74 65 20 61 6e 20 65 |.{calcul|ate an e|
|00004020| 76 65 6e 20 23 20 6f 66 | 20 77 6f 72 64 73 7d 0d |ven # of| words}.|
|00004030| 09 09 09 09 09 09 09 62 | 69 74 73 53 69 7a 65 20 |.......b|itsSize |
|00004040| 3a 3d 20 62 6f 74 74 6f | 6d 20 2a 20 4c 4f 4e 47 |:= botto|m * LONG|
|00004050| 49 4e 54 28 72 6f 77 42 | 79 74 65 73 29 3b 20 7b |INT(rowB|ytes); {|
|00004060| 63 61 6c 63 75 6c 61 74 | 65 20 74 68 65 20 73 69 |calculat|e the si|
|00004070| 7a 65 7d 0d 09 09 09 09 | 09 09 45 4e 44 3b 20 7b |ze}.....|..END; {|
|00004080| 57 49 54 48 7d 0d 09 09 | 09 09 09 09 6d 61 70 20 |WITH}...|....map |
|00004090| 3a 3d 20 40 70 6f 72 74 | 42 69 74 73 3b 20 7b 70 |:= @port|Bits; {p|
|000040a0| 6f 69 6e 74 20 74 6f 20 | 74 68 65 20 6d 61 70 20 |oint to |the map |
|000040b0| 73 6f 20 77 65 20 63 61 | 6e 20 73 65 74 20 69 74 |so we ca|n set it|
|000040c0| 20 75 70 7d 0d 09 09 09 | 09 09 45 4e 44 3b 20 7b | up}....|..END; {|
|000040d0| 57 49 54 48 7d 0d 09 09 | 09 09 45 4e 44 3b 0d 09 |WITH}...|..END;..|
|000040e0| 09 09 09 09 0d 09 09 09 | 09 57 49 54 48 20 62 69 |........|.WITH bi|
|000040f0| 74 73 50 6f 72 74 5e 20 | 44 4f 20 42 45 47 49 4e |tsPort^ |DO BEGIN|
|00004100| 0d 09 09 09 09 09 70 6f | 72 74 52 65 63 74 20 3a |......po|rtRect :|
|00004110| 3d 20 6d 61 70 5e 2e 62 | 6f 75 6e 64 73 3b 20 7b |= map^.b|ounds; {|
|00004120| 70 6f 72 74 27 73 20 70 | 6f 72 74 52 65 63 74 20 |port's p|ortRect |
|00004130| 69 73 20 73 61 6d 65 20 | 61 73 20 62 6f 75 6e 64 |is same |as bound|
|00004140| 73 7d 0d 09 09 09 09 09 | 52 65 63 74 52 67 6e 28 |s}......|RectRgn(|
|00004150| 76 69 73 52 67 6e 2c 20 | 70 6f 72 74 52 65 63 74 |visRgn, |portRect|
|00004160| 29 3b 20 7b 74 68 65 20 | 76 69 73 52 67 6e 20 6d |); {the |visRgn m|
|00004170| 75 73 74 20 62 65 20 63 | 68 61 6e 67 65 64 7d 0d |ust be c|hanged}.|
|00004180| 09 09 09 09 09 69 6e 76 | 61 6c 52 65 67 69 6f 6e |.....inv|alRegion|
|00004190| 20 3a 3d 20 4e 65 77 52 | 67 6e 3b 0d 09 09 09 09 | := NewR|gn;.....|
|000041a0| 09 4f 75 74 28 4d 65 6d | 45 72 72 6f 72 29 3b 0d |.Out(Mem|Error);.|
|000041b0| 09 09 09 09 09 43 6f 70 | 79 52 67 6e 28 76 69 73 |.....Cop|yRgn(vis|
|000041c0| 52 67 6e 2c 20 69 6e 76 | 61 6c 52 65 67 69 6f 6e |Rgn, inv|alRegion|
|000041d0| 29 3b 0d 09 09 09 09 45 | 4e 44 3b 20 7b 57 49 54 |);.....E|ND; {WIT|
|000041e0| 48 7d 0d 09 09 09 09 0d | 09 09 09 09 62 69 74 73 |H}......|....bits|
|000041f0| 20 3a 3d 20 48 61 6e 64 | 6c 65 28 4e 65 77 49 6d | := Hand|le(NewIm|
|00004200| 70 72 6f 76 65 64 47 42 | 75 66 66 65 72 28 62 69 |provedGB|uffer(bi|
|00004210| 74 73 53 69 7a 65 2c 20 | 6e 65 65 64 73 33 32 42 |tsSize, |needs32B|
|00004220| 69 74 73 2c 20 62 75 66 | 66 4e 6f 74 4e 65 65 64 |its, buf|fNotNeed|
|00004230| 65 64 29 29 3b 0d 09 09 | 09 09 6e 6f 74 4f 75 72 |ed));...|..notOur|
|00004240| 73 20 3a 3d 20 62 69 74 | 73 20 3c 3e 20 4e 49 4c |s := bit|s <> NIL|
|00004250| 3b 0d 09 09 09 09 49 46 | 20 4e 4f 54 20 6e 6f 74 |;.....IF| NOT not|
|00004260| 4f 75 72 73 20 54 48 45 | 4e 20 42 45 47 49 4e 0d |Ours THE|N BEGIN.|
|00004270| 09 09 09 09 09 49 46 20 | 72 65 71 75 65 73 74 65 |.....IF |requeste|
|00004280| 64 50 6f 6c 69 74 65 20 | 54 48 45 4e 0d 09 09 09 |dPolite |THEN....|
|00004290| 09 09 09 63 6f 6e 74 69 | 67 75 6f 75 73 53 70 61 |...conti|guousSpa|
|000042a0| 63 65 20 3a 3d 20 4d 61 | 78 42 6c 6f 63 6b 20 7b |ce := Ma|xBlock {|
|000042b0| 6d 61 6b 65 20 73 75 72 | 65 20 77 65 20 68 61 76 |make sur|e we hav|
|000042c0| 65 20 72 6f 6f 6d 20 77 | 69 74 68 6f 75 74 20 70 |e room w|ithout p|
|000042d0| 75 72 67 69 6e 67 7d 0d | 09 09 09 09 09 45 4c 53 |urging}.|.....ELS|
|000042e0| 45 0d 09 09 09 09 09 09 | 50 75 72 67 65 53 70 61 |E.......|PurgeSpa|
|000042f0| 63 65 28 74 6f 74 61 6c | 53 70 61 63 65 2c 20 63 |ce(total|Space, c|
|00004300| 6f 6e 74 69 67 75 6f 75 | 73 53 70 61 63 65 29 3b |ontiguou|sSpace);|
|00004310| 20 7b 6d 61 6b 65 20 73 | 75 72 65 20 77 65 20 68 | {make s|ure we h|
|00004320| 61 76 65 20 72 6f 6f 6d | 20 77 69 74 68 20 70 75 |ave room| with pu|
|00004330| 72 67 69 6e 67 7d 0d 09 | 09 09 09 09 49 46 20 62 |rging}..|....IF b|
|00004340| 69 74 73 53 69 7a 65 20 | 2b 20 6b 4f 66 66 73 63 |itsSize |+ kOffsc|
|00004350| 72 65 65 6e 52 65 73 65 | 72 76 65 20 3e 20 63 6f |reenRese|rve > co|
|00004360| 6e 74 69 67 75 6f 75 73 | 53 70 61 63 65 20 54 48 |ntiguous|Space TH|
|00004370| 45 4e 0d 09 09 09 09 09 | 09 7b 69 66 20 74 68 65 |EN......|.{if the|
|00004380| 72 65 20 69 73 20 6e 6f | 74 20 65 6e 6f 75 67 68 |re is no|t enough|
|00004390| 20 72 6f 6f 6d 20 66 6f | 72 20 74 68 65 20 62 69 | room fo|r the bi|
|000043a0| 74 73 20 26 20 72 65 73 | 65 72 76 65 20 62 6c 6f |ts & res|erve blo|
|000043b0| 63 6b 2c 20 65 72 72 6f | 72 20 6f 75 74 7d 0d 09 |ck, erro|r out}..|
|000043c0| 09 09 09 09 09 4f 75 74 | 28 6d 65 6d 46 75 6c 6c |.....Out|(memFull|
|000043d0| 45 72 72 29 3b 0d 09 09 | 09 09 09 62 69 74 73 20 |Err);...|...bits |
|000043e0| 3a 3d 20 4e 65 77 48 61 | 6e 64 6c 65 43 6c 65 61 |:= NewHa|ndleClea|
|000043f0| 72 28 62 69 74 73 53 69 | 7a 65 29 3b 20 7b 67 65 |r(bitsSi|ze); {ge|
|00004400| 74 20 73 70 61 63 65 20 | 66 6f 72 20 74 68 65 20 |t space |for the |
|00004410| 62 69 74 73 7d 0d 09 09 | 09 09 09 4f 75 74 28 4d |bits}...|...Out(M|
|00004420| 65 6d 45 72 72 6f 72 29 | 3b 0d 09 09 09 09 09 49 |emError)|;......I|
|00004430| 46 20 72 65 71 75 65 73 | 74 65 64 50 6f 6c 69 74 |F reques|tedPolit|
|00004440| 65 20 54 48 45 4e 0d 09 | 09 09 09 09 09 48 50 75 |e THEN..|.....HPu|
|00004450| 72 67 65 28 62 69 74 73 | 29 3b 20 7b 6b 65 65 70 |rge(bits|); {keep|
|00004460| 20 62 69 74 73 20 70 75 | 72 67 65 61 62 6c 65 20 | bits pu|rgeable |
|00004470| 69 66 20 77 65 20 61 72 | 65 20 70 6f 6c 69 74 65 |if we ar|e polite|
|00004480| 7d 0d 09 09 09 09 45 4e | 44 3b 0d 09 09 09 09 0d |}.....EN|D;......|
|00004490| 09 09 09 45 4e 44 3b 20 | 7b 57 49 54 48 7d 0d 09 |...END; |{WITH}..|
|000044a0| 09 09 48 55 6e 6c 6f 63 | 6b 28 6f 66 66 73 63 72 |..HUnloc|k(offscr|
|000044b0| 65 65 6e 48 61 6e 64 6c | 65 29 3b 0d 0d 09 09 09 |eenHandl|e);.....|
|000044c0| 53 65 74 50 6f 72 74 28 | 6f 6c 64 50 6f 72 74 29 |SetPort(|oldPort)|
|000044d0| 3b 0d 09 09 45 4e 44 3b | 20 7b 49 46 20 47 65 74 |;...END;| {IF Get|
|000044e0| 4d 61 70 28 6f 66 66 73 | 63 72 65 65 6e 48 61 6e |Map(offs|creenHan|
|000044f0| 64 6c 65 29 20 3d 20 4e | 49 4c 7d 0d 0d 09 41 6c |dle) = N|IL}...Al|
|00004500| 6c 6f 63 61 74 65 42 69 | 74 73 20 3a 3d 20 6e 6f |locateBi|ts := no|
|00004510| 45 72 72 3b 0d 45 4e 44 | 3b 20 7b 41 6c 6c 6f 63 |Err;.END|; {Alloc|
|00004520| 61 74 65 42 69 74 73 7d | 0d 0d 0d 0d 50 52 4f 43 |ateBits}|....PROC|
|00004530| 45 44 55 52 45 20 44 69 | 73 70 6f 73 65 4f 66 66 |EDURE Di|sposeOff|
|00004540| 73 63 72 65 65 6e 28 6f | 66 66 73 63 72 65 65 6e |screen(o|ffscreen|
|00004550| 48 61 6e 64 6c 65 3a 20 | 48 61 6e 64 6c 65 29 3b |Handle: |Handle);|
|00004560| 0d 7b 47 65 74 20 72 69 | 64 20 6f 66 20 65 76 65 |.{Get ri|d of eve|
|00004570| 72 79 74 68 69 6e 67 2c | 20 69 6e 63 6c 75 64 69 |rything,| includi|
|00004580| 6e 67 20 6f 66 66 73 63 | 72 65 65 6e 48 61 6e 64 |ng offsc|reenHand|
|00004590| 6c 65 20 69 74 73 65 6c | 66 2e 7d 0d 0d 42 45 47 |le itsel|f.}..BEG|
|000045a0| 49 4e 20 7b 44 69 73 70 | 6f 73 65 4f 66 66 73 63 |IN {Disp|oseOffsc|
|000045b0| 72 65 65 6e 7d 0d 09 49 | 46 20 6f 66 66 73 63 72 |reen}..I|F offscr|
|000045c0| 65 65 6e 48 61 6e 64 6c | 65 20 3c 3e 20 4e 49 4c |eenHandl|e <> NIL|
|000045d0| 20 54 48 45 4e 20 42 45 | 47 49 4e 0d 09 09 44 65 | THEN BE|GIN...De|
|000045e0| 61 6c 6c 6f 63 61 74 65 | 42 69 74 73 28 6f 66 66 |allocate|Bits(off|
|000045f0| 73 63 72 65 65 6e 48 61 | 6e 64 6c 65 29 3b 0d 09 |screenHa|ndle);..|
|00004600| 09 44 69 73 70 6f 73 48 | 61 6e 64 6c 65 28 48 61 |.DisposH|andle(Ha|
|00004610| 6e 64 6c 65 28 50 72 69 | 76 61 74 65 48 61 6e 64 |ndle(Pri|vateHand|
|00004620| 6c 65 28 6f 66 66 73 63 | 72 65 65 6e 48 61 6e 64 |le(offsc|reenHand|
|00004630| 6c 65 29 5e 5e 2e 72 65 | 71 75 65 73 74 65 64 43 |le)^^.re|questedC|
|00004640| 6f 6c 6f 72 73 29 29 3b | 0d 09 09 44 69 73 70 6f |olors));|...Dispo|
|00004650| 73 48 61 6e 64 6c 65 28 | 6f 66 66 73 63 72 65 65 |sHandle(|offscree|
|00004660| 6e 48 61 6e 64 6c 65 29 | 3b 0d 09 45 4e 44 3b 20 |nHandle)|;..END; |
|00004670| 7b 49 46 20 6f 66 66 73 | 63 72 65 65 6e 48 61 6e |{IF offs|creenHan|
|00004680| 64 6c 65 20 3c 3e 20 4e | 49 4c 7d 0d 45 4e 44 3b |dle <> N|IL}.END;|
|00004690| 20 7b 44 69 73 70 6f 73 | 65 4f 66 66 73 63 72 65 | {Dispos|eOffscre|
|000046a0| 65 6e 7d 0d 0d 0d 0d 46 | 55 4e 43 54 49 4f 4e 20 |en}....F|UNCTION |
|000046b0| 4e 65 77 4f 66 66 73 63 | 72 65 65 6e 28 62 6f 75 |NewOffsc|reen(bou|
|000046c0| 6e 64 73 3a 20 52 65 63 | 74 3b 20 64 65 70 74 68 |nds: Rec|t; depth|
|000046d0| 3a 20 49 4e 54 45 47 45 | 52 3b 20 63 6f 6c 6f 72 |: INTEGE|R; color|
|000046e0| 73 3a 20 43 54 61 62 48 | 61 6e 64 6c 65 3b 0d 09 |s: CTabH|andle;..|
|000046f0| 09 09 09 09 20 20 6d 65 | 6d 6f 72 79 50 6f 6c 69 |.... me|moryPoli|
|00004700| 74 65 3a 20 42 4f 4f 4c | 45 41 4e 3b 20 56 41 52 |te: BOOL|EAN; VAR|
|00004710| 20 62 75 66 66 4e 6f 74 | 4e 65 65 64 65 64 3a 20 | buffNot|Needed: |
|00004720| 42 4f 4f 4c 45 41 4e 3b | 20 56 41 52 20 6f 66 66 |BOOLEAN;| VAR off|
|00004730| 73 63 72 65 65 6e 48 61 | 6e 64 6c 65 3a 20 48 61 |screenHa|ndle: Ha|
|00004740| 6e 64 6c 65 29 3a 20 4f | 53 45 72 72 3b 0d 7b 43 |ndle): O|SErr;.{C|
|00004750| 72 65 61 74 65 20 61 6e | 20 6f 66 66 73 63 72 65 |reate an| offscre|
|00004760| 65 6e 48 61 6e 64 6c 65 | 2e 20 52 65 74 75 72 6e |enHandle|. Return|
|00004770| 20 4e 49 4c 20 69 66 20 | 74 68 65 72 65 20 69 73 | NIL if |there is|
|00004780| 20 61 6e 20 65 72 72 6f | 72 2e 7d 0d 0d 56 41 52 | an erro|r.}..VAR|
|00004790| 0d 09 61 48 61 6e 64 6c | 65 09 3a 20 48 61 6e 64 |..aHandl|e.: Hand|
|000047a0| 6c 65 3b 0d 0d 09 50 52 | 4f 43 45 44 55 52 45 20 |le;...PR|OCEDURE |
|000047b0| 4f 75 74 28 65 72 72 6f | 72 3a 20 4f 53 45 72 72 |Out(erro|r: OSErr|
|000047c0| 29 3b 0d 09 42 45 47 49 | 4e 20 7b 4f 75 74 7d 0d |);..BEGI|N {Out}.|
|000047d0| 09 09 49 46 20 65 72 72 | 6f 72 20 3c 3e 20 6e 6f |..IF err|or <> no|
|000047e0| 45 72 72 20 54 48 45 4e | 20 42 45 47 49 4e 0d 09 |Err THEN| BEGIN..|
|000047f0| 09 09 44 69 73 70 6f 73 | 48 61 6e 64 6c 65 28 61 |..Dispos|Handle(a|
|00004800| 48 61 6e 64 6c 65 29 3b | 20 7b 64 69 73 70 6f 73 |Handle);| {dispos|
|00004810| 65 20 68 61 6e 64 6c 65 | 20 69 66 20 77 65 20 6d |e handle| if we m|
|00004820| 61 64 65 20 69 74 7d 0d | 09 09 09 4e 65 77 4f 66 |ade it}.|...NewOf|
|00004830| 66 73 63 72 65 65 6e 20 | 3a 3d 20 65 72 72 6f 72 |fscreen |:= error|
|00004840| 3b 0d 09 09 09 6f 66 66 | 73 63 72 65 65 6e 48 61 |;....off|screenHa|
|00004850| 6e 64 6c 65 20 3a 3d 20 | 4e 49 4c 3b 0d 09 09 09 |ndle := |NIL;....|
|00004860| 45 58 49 54 28 4e 65 77 | 4f 66 66 73 63 72 65 65 |EXIT(New|Offscree|
|00004870| 6e 29 3b 0d 09 09 45 4e | 44 3b 20 7b 49 46 20 65 |n);...EN|D; {IF e|
|00004880| 72 72 6f 72 20 3c 3e 20 | 6e 6f 45 72 72 7d 0d 09 |rror <> |noErr}..|
|00004890| 45 4e 44 3b 20 7b 4f 75 | 74 7d 0d 0d 42 45 47 49 |END; {Ou|t}..BEGI|
|000048a0| 4e 20 7b 4e 65 77 4f 66 | 66 73 63 72 65 65 6e 7d |N {NewOf|fscreen}|
|000048b0| 0d 09 61 48 61 6e 64 6c | 65 20 3a 3d 20 4e 65 77 |..aHandl|e := New|
|000048c0| 48 61 6e 64 6c 65 43 6c | 65 61 72 28 53 69 7a 65 |HandleCl|ear(Size|
|000048d0| 4f 66 28 50 72 69 76 61 | 74 65 52 65 63 6f 72 64 |Of(Priva|teRecord|
|000048e0| 29 29 3b 20 7b 6d 61 6b | 65 20 74 68 65 20 70 72 |)); {mak|e the pr|
|000048f0| 69 76 61 74 65 20 62 6c | 6f 63 6b 7d 0d 09 4f 75 |ivate bl|ock}..Ou|
|00004900| 74 28 4d 65 6d 45 72 72 | 6f 72 29 3b 0d 0d 09 4d |t(MemErr|or);...M|
|00004910| 6f 76 65 48 48 69 28 61 | 48 61 6e 64 6c 65 29 3b |oveHHi(a|Handle);|
|00004920| 20 7b 66 6c 79 20 74 68 | 69 73 20 68 69 67 68 20 | {fly th|is high |
|00004930| 73 6f 20 69 74 20 64 6f | 65 73 6e 27 74 20 66 72 |so it do|esn't fr|
|00004940| 61 67 6d 65 6e 74 20 74 | 68 65 20 68 65 61 70 7d |agment t|he heap}|
|00004950| 0d 09 48 4c 6f 63 6b 28 | 61 48 61 6e 64 6c 65 29 |..HLock(|aHandle)|
|00004960| 3b 0d 09 57 49 54 48 20 | 50 72 69 76 61 74 65 48 |;..WITH |PrivateH|
|00004970| 61 6e 64 6c 65 28 61 48 | 61 6e 64 6c 65 29 5e 5e |andle(aH|andle)^^|
|00004980| 20 44 4f 20 42 45 47 49 | 4e 0d 09 09 72 65 71 75 | DO BEGI|N...requ|
|00004990| 65 73 74 65 64 42 6f 75 | 6e 64 73 20 3a 3d 20 62 |estedBou|nds := b|
|000049a0| 6f 75 6e 64 73 3b 0d 09 | 09 49 46 20 74 68 65 4d |ounds;..|.IF theM|
|000049b0| 61 63 2e 68 61 73 43 6f | 6c 6f 72 51 44 20 54 48 |ac.hasCo|lorQD TH|
|000049c0| 45 4e 0d 09 09 09 72 65 | 71 75 65 73 74 65 64 44 |EN....re|questedD|
|000049d0| 65 70 74 68 20 3a 3d 20 | 64 65 70 74 68 0d 09 09 |epth := |depth...|
|000049e0| 45 4c 53 45 0d 09 09 09 | 72 65 71 75 65 73 74 65 |ELSE....|requeste|
|000049f0| 64 44 65 70 74 68 20 3a | 3d 20 6e 6f 44 65 70 74 |dDepth :|= noDept|
|00004a00| 68 3b 0d 09 09 49 46 20 | 72 65 71 75 65 73 74 65 |h;...IF |requeste|
|00004a10| 64 44 65 70 74 68 20 3e | 20 30 20 54 48 45 4e 20 |dDepth >| 0 THEN |
|00004a20| 42 45 47 49 4e 20 7b 69 | 66 20 77 65 20 6e 65 65 |BEGIN {i|f we nee|
|00004a30| 64 20 61 20 70 72 69 76 | 61 74 65 20 64 65 76 69 |d a priv|ate devi|
|00004a40| 63 65 7d 0d 09 09 09 4f | 75 74 28 48 61 6e 64 54 |ce}....O|ut(HandT|
|00004a50| 6f 48 61 6e 64 28 48 61 | 6e 64 6c 65 28 63 6f 6c |oHand(Ha|ndle(col|
|00004a60| 6f 72 73 29 29 29 3b 0d | 09 09 09 72 65 71 75 65 |ors)));.|...reque|
|00004a70| 73 74 65 64 43 6f 6c 6f | 72 73 20 3a 3d 20 63 6f |stedColo|rs := co|
|00004a80| 6c 6f 72 73 3b 0d 09 09 | 45 4e 44 3b 0d 09 09 72 |lors;...|END;...r|
|00004a90| 65 71 75 65 73 74 65 64 | 50 6f 6c 69 74 65 20 3a |equested|Polite :|
|00004aa0| 3d 20 6d 65 6d 6f 72 79 | 50 6f 6c 69 74 65 3b 0d |= memory|Polite;.|
|00004ab0| 09 45 4e 44 3b 20 7b 57 | 49 54 48 7d 0d 09 48 55 |.END; {W|ITH}..HU|
|00004ac0| 6e 6c 6f 63 6b 28 61 48 | 61 6e 64 6c 65 29 3b 0d |nlock(aH|andle);.|
|00004ad0| 0d 09 7b 6e 6f 77 2c 20 | 77 65 20 68 61 76 65 20 |..{now, |we have |
|00004ae0| 66 69 6c 6c 65 64 20 69 | 6e 20 61 6c 6c 20 6f 66 |filled i|n all of|
|00004af0| 20 74 68 65 20 66 69 65 | 6c 64 73 20 6f 66 20 6f | the fie|lds of o|
|00004b00| 66 66 73 63 72 65 65 6e | 48 61 6e 64 6c 65 7d 0d |ffscreen|Handle}.|
|00004b10| 09 4e 65 77 4f 66 66 73 | 63 72 65 65 6e 20 3a 3d |.NewOffs|creen :=|
|00004b20| 20 41 6c 6c 6f 63 61 74 | 65 42 69 74 73 28 61 48 | Allocat|eBits(aH|
|00004b30| 61 6e 64 6c 65 2c 20 62 | 75 66 66 4e 6f 74 4e 65 |andle, b|uffNotNe|
|00004b40| 65 64 65 64 29 3b 0d 09 | 6f 66 66 73 63 72 65 65 |eded);..|offscree|
|00004b50| 6e 48 61 6e 64 6c 65 20 | 3a 3d 20 61 48 61 6e 64 |nHandle |:= aHand|
|00004b60| 6c 65 3b 0d 45 4e 44 3b | 20 7b 4e 65 77 4f 66 66 |le;.END;| {NewOff|
|00004b70| 73 63 72 65 65 6e 7d 0d | 0d 0d 0d 46 55 4e 43 54 |screen}.|...FUNCT|
|00004b80| 49 4f 4e 20 43 68 65 63 | 6b 4f 66 66 73 63 72 65 |ION Chec|kOffscre|
|00004b90| 65 6e 28 6f 66 66 73 63 | 72 65 65 6e 48 61 6e 64 |en(offsc|reenHand|
|00004ba0| 6c 65 3a 20 48 61 6e 64 | 6c 65 3b 20 56 41 52 20 |le: Hand|le; VAR |
|00004bb0| 64 72 61 77 4e 65 65 64 | 65 64 3a 20 42 4f 4f 4c |drawNeed|ed: BOOL|
|00004bc0| 45 41 4e 29 3a 20 4f 53 | 45 72 72 3b 0d 0d 56 41 |EAN): OS|Err;..VA|
|00004bd0| 52 0d 09 65 72 72 6f 72 | 09 09 09 3a 20 4f 53 45 |R..error|...: OSE|
|00004be0| 72 72 3b 0d 09 6e 65 77 | 53 65 65 64 09 09 09 3a |rr;..new|Seed...:|
|00004bf0| 20 4c 4f 4e 47 49 4e 54 | 3b 0d 09 62 75 66 66 4e | LONGINT|;..buffN|
|00004c00| 6f 74 4e 65 65 64 65 64 | 09 3a 20 42 4f 4f 4c 45 |otNeeded|.: BOOLE|
|00004c10| 41 4e 3b 0d 0d 42 45 47 | 49 4e 20 7b 43 68 65 63 |AN;..BEG|IN {Chec|
|00004c20| 6b 4f 66 66 73 63 72 65 | 65 6e 7d 0d 09 64 72 61 |kOffscre|en}..dra|
|00004c30| 77 4e 65 65 64 65 64 20 | 3a 3d 20 54 52 55 45 3b |wNeeded |:= TRUE;|
|00004c40| 20 7b 64 65 66 61 75 6c | 74 20 77 65 20 6d 75 73 | {defaul|t we mus|
|00004c50| 74 20 64 72 61 77 20 69 | 66 20 6f 66 66 73 63 72 |t draw i|f offscr|
|00004c60| 65 65 6e 20 69 6e 76 61 | 6c 69 64 7d 0d 09 65 72 |een inva|lid}..er|
|00004c70| 72 6f 72 20 3a 3d 20 6e | 6f 45 72 72 3b 20 7b 6e |ror := n|oErr; {n|
|00004c80| 6f 20 65 72 72 6f 72 20 | 65 69 74 68 65 72 7d 0d |o error |either}.|
|00004c90| 09 49 46 20 6f 66 66 73 | 63 72 65 65 6e 48 61 6e |.IF offs|creenHan|
|00004ca0| 64 6c 65 20 3c 3e 20 4e | 49 4c 20 54 48 45 4e 0d |dle <> N|IL THEN.|
|00004cb0| 09 09 57 49 54 48 20 50 | 72 69 76 61 74 65 48 61 |..WITH P|rivateHa|
|00004cc0| 6e 64 6c 65 28 6f 66 66 | 73 63 72 65 65 6e 48 61 |ndle(off|screenHa|
|00004cd0| 6e 64 6c 65 29 5e 5e 20 | 44 4f 20 42 45 47 49 4e |ndle)^^ |DO BEGIN|
|00004ce0| 0d 09 09 09 49 46 20 72 | 65 71 75 65 73 74 65 64 |....IF r|equested|
|00004cf0| 44 65 70 74 68 20 3d 20 | 6b 4d 61 78 44 65 70 74 |Depth = |kMaxDept|
|00004d00| 68 20 54 48 45 4e 20 7b | 69 66 20 69 74 27 73 20 |h THEN {|if it's |
|00004d10| 6e 6f 74 20 61 20 70 72 | 69 76 61 74 65 20 64 65 |not a pr|ivate de|
|00004d20| 76 69 63 65 7d 0d 09 09 | 09 09 49 46 20 6f 6c 64 |vice}...|..IF old|
|00004d30| 53 65 65 64 20 3c 3e 20 | 62 69 74 73 44 65 76 69 |Seed <> |bitsDevi|
|00004d40| 63 65 5e 5e 2e 67 64 50 | 4d 61 70 5e 5e 2e 70 6d |ce^^.gdP|Map^^.pm|
|00004d50| 54 61 62 6c 65 5e 5e 2e | 63 74 53 65 65 64 20 54 |Table^^.|ctSeed T|
|00004d60| 48 45 4e 20 7b 77 65 20 | 68 61 76 65 20 61 20 63 |HEN {we |have a c|
|00004d70| 6f 6c 6f 72 20 75 70 64 | 61 74 65 2c 20 48 6f 75 |olor upd|ate, Hou|
|00004d80| 73 74 6f 6e 7d 0d 09 09 | 09 09 09 44 65 61 6c 6c |ston}...|...Deall|
|00004d90| 6f 63 61 74 65 42 69 74 | 73 28 6f 66 66 73 63 72 |ocateBit|s(offscr|
|00004da0| 65 65 6e 48 61 6e 64 6c | 65 29 3b 0d 0d 09 09 09 |eenHandl|e);.....|
|00004db0| 64 72 61 77 4e 65 65 64 | 65 64 20 3a 3d 20 47 65 |drawNeed|ed := Ge|
|00004dc0| 74 4d 61 70 28 6f 66 66 | 73 63 72 65 65 6e 48 61 |tMap(off|screenHa|
|00004dd0| 6e 64 6c 65 29 20 3d 20 | 4e 49 4c 3b 0d 09 09 09 |ndle) = |NIL;....|
|00004de0| 65 72 72 6f 72 20 3a 3d | 20 41 6c 6c 6f 63 61 74 |error :=| Allocat|
|00004df0| 65 42 69 74 73 28 6f 66 | 66 73 63 72 65 65 6e 48 |eBits(of|fscreenH|
|00004e00| 61 6e 64 6c 65 2c 20 62 | 75 66 66 4e 6f 74 4e 65 |andle, b|uffNotNe|
|00004e10| 65 64 65 64 29 3b 20 7b | 61 6c 6c 6f 63 61 74 65 |eded); {|allocate|
|00004e20| 20 69 66 20 64 65 61 6c | 6c 6f 63 61 74 65 64 7d | if deal|located}|
|00004e30| 0d 09 09 45 4e 44 3b 20 | 7b 57 49 54 48 7d 0d 09 |...END; |{WITH}..|
|00004e40| 09 09 0d 09 49 46 20 47 | 65 74 4d 61 70 28 6f 66 |....IF G|etMap(of|
|00004e50| 66 73 63 72 65 65 6e 48 | 61 6e 64 6c 65 29 20 3c |fscreenH|andle) <|
|00004e60| 3e 20 4e 49 4c 20 54 48 | 45 4e 0d 09 09 64 72 61 |> NIL TH|EN...dra|
|00004e70| 77 4e 65 65 64 65 64 20 | 3a 3d 20 64 72 61 77 4e |wNeeded |:= drawN|
|00004e80| 65 65 64 65 64 20 7c 20 | 28 4e 4f 54 20 45 6d 70 |eeded | |(NOT Emp|
|00004e90| 74 79 52 67 6e 28 50 72 | 69 76 61 74 65 48 61 6e |tyRgn(Pr|ivateHan|
|00004ea0| 64 6c 65 28 6f 66 66 73 | 63 72 65 65 6e 48 61 6e |dle(offs|creenHan|
|00004eb0| 64 6c 65 29 5e 5e 2e 69 | 6e 76 61 6c 52 65 67 69 |dle)^^.i|nvalRegi|
|00004ec0| 6f 6e 29 29 3b 0d 09 09 | 7b 63 61 6e d5 74 20 75 |on));...|{can.t u|
|00004ed0| 73 65 20 74 68 65 20 77 | 69 64 74 68 20 66 6f 72 |se the w|idth for|
|00004ee0| 20 69 6e 76 61 6c 52 65 | 67 69 6f 6e 20 73 69 6e | invalRe|gion sin|
|00004ef0| 63 65 20 77 65 20 6d 61 | 79 20 68 61 76 65 20 64 |ce we ma|y have d|
|00004f00| 6f 6e 65 20 61 6e 20 41 | 6c 6c 6f 63 61 74 65 42 |one an A|llocateB|
|00004f10| 69 74 73 7d 0d 09 09 0d | 09 43 68 65 63 6b 4f 66 |its}....|.CheckOf|
|00004f20| 66 73 63 72 65 65 6e 20 | 3a 3d 20 65 72 72 6f 72 |fscreen |:= error|
|00004f30| 3b 0d 45 4e 44 3b 20 7b | 43 68 65 63 6b 4f 66 66 |;.END; {|CheckOff|
|00004f40| 73 63 72 65 65 6e 7d 0d | 0d 0d 50 52 4f 43 45 44 |screen}.|..PROCED|
|00004f50| 55 52 45 20 56 61 6c 69 | 64 52 65 63 74 4f 66 66 |URE Vali|dRectOff|
|00004f60| 73 63 72 65 65 6e 28 6f | 66 66 73 63 72 65 65 6e |screen(o|ffscreen|
|00004f70| 48 61 6e 64 6c 65 3a 20 | 48 61 6e 64 6c 65 3b 20 |Handle: |Handle; |
|00004f80| 77 69 6e 64 6f 77 3a 20 | 57 69 6e 64 6f 77 50 74 |window: |WindowPt|
|00004f90| 72 3b 20 76 61 6c 69 64 | 52 65 63 74 3a 20 52 65 |r; valid|Rect: Re|
|00004fa0| 63 74 29 3b 0d 0d 56 41 | 52 0d 09 76 61 6c 69 64 |ct);..VA|R..valid|
|00004fb0| 52 67 6e 09 3a 20 52 67 | 6e 48 61 6e 64 6c 65 3b |Rgn.: Rg|nHandle;|
|00004fc0| 0d 0d 42 45 47 49 4e 0d | 09 76 61 6c 69 64 52 67 |..BEGIN.|.validRg|
|00004fd0| 6e 20 3a 3d 20 4e 65 77 | 52 67 6e 3b 0d 09 52 65 |n := New|Rgn;..Re|
|00004fe0| 63 74 52 67 6e 28 76 61 | 6c 69 64 52 67 6e 2c 20 |ctRgn(va|lidRgn, |
|00004ff0| 76 61 6c 69 64 52 65 63 | 74 29 3b 0d 09 56 61 6c |validRec|t);..Val|
|00005000| 69 64 52 67 6e 4f 66 66 | 73 63 72 65 65 6e 28 6f |idRgnOff|screen(o|
|00005010| 66 66 73 63 72 65 65 6e | 48 61 6e 64 6c 65 2c 20 |ffscreen|Handle, |
|00005020| 77 69 6e 64 6f 77 2c 20 | 76 61 6c 69 64 52 67 6e |window, |validRgn|
|00005030| 29 3b 0d 09 44 69 73 70 | 6f 73 65 52 67 6e 28 76 |);..Disp|oseRgn(v|
|00005040| 61 6c 69 64 52 67 6e 29 | 3b 0d 45 4e 44 3b 20 7b |alidRgn)|;.END; {|
|00005050| 56 61 6c 69 64 52 65 63 | 74 4f 66 66 73 63 72 65 |ValidRec|tOffscre|
|00005060| 65 6e 7d 0d 0d 0d 50 52 | 4f 43 45 44 55 52 45 20 |en}...PR|OCEDURE |
|00005070| 56 61 6c 69 64 52 67 6e | 4f 66 66 73 63 72 65 65 |ValidRgn|Offscree|
|00005080| 6e 28 6f 66 66 73 63 72 | 65 65 6e 48 61 6e 64 6c |n(offscr|eenHandl|
|00005090| 65 3a 20 48 61 6e 64 6c | 65 3b 20 77 69 6e 64 6f |e: Handl|e; windo|
|000050a0| 77 3a 20 57 69 6e 64 6f | 77 50 74 72 3b 20 76 61 |w: Windo|wPtr; va|
|000050b0| 6c 69 64 52 65 67 69 6f | 6e 3a 20 52 67 6e 48 61 |lidRegio|n: RgnHa|
|000050c0| 6e 64 6c 65 29 3b 0d 0d | 56 41 52 0d 09 73 61 76 |ndle);..|VAR..sav|
|000050d0| 65 64 50 6f 72 74 09 3a | 20 47 72 61 66 50 74 72 |edPort.:| GrafPtr|
|000050e0| 3b 0d 09 0d 42 45 47 49 | 4e 0d 09 49 46 20 77 69 |;...BEGI|N..IF wi|
|000050f0| 6e 64 6f 77 20 3c 3e 20 | 4e 49 4c 20 54 48 45 4e |ndow <> |NIL THEN|
|00005100| 20 42 45 47 49 4e 0d 09 | 09 47 65 74 50 6f 72 74 | BEGIN..|.GetPort|
|00005110| 28 73 61 76 65 64 50 6f | 72 74 29 3b 0d 09 09 53 |(savedPo|rt);...S|
|00005120| 65 74 50 6f 72 74 28 77 | 69 6e 64 6f 77 29 3b 0d |etPort(w|indow);.|
|00005130| 09 09 56 61 6c 69 64 52 | 67 6e 28 76 61 6c 69 64 |..ValidR|gn(valid|
|00005140| 52 65 67 69 6f 6e 29 3b | 0d 09 09 53 65 74 50 6f |Region);|...SetPo|
|00005150| 72 74 28 73 61 76 65 64 | 50 6f 72 74 29 3b 0d 09 |rt(saved|Port);..|
|00005160| 45 4e 44 3b 0d 09 49 46 | 20 47 65 74 4d 61 70 28 |END;..IF| GetMap(|
|00005170| 6f 66 66 73 63 72 65 65 | 6e 48 61 6e 64 6c 65 29 |offscree|nHandle)|
|00005180| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 0d 09 09 57 | <> NIL |THEN...W|
|00005190| 49 54 48 20 50 72 69 76 | 61 74 65 48 61 6e 64 6c |ITH Priv|ateHandl|
|000051a0| 65 28 6f 66 66 73 63 72 | 65 65 6e 48 61 6e 64 6c |e(offscr|eenHandl|
|000051b0| 65 29 5e 5e 20 44 4f 0d | 09 09 09 44 69 66 66 52 |e)^^ DO.|...DiffR|
|000051c0| 67 6e 28 69 6e 76 61 6c | 52 65 67 69 6f 6e 2c 20 |gn(inval|Region, |
|000051d0| 76 61 6c 69 64 52 65 67 | 69 6f 6e 2c 20 69 6e 76 |validReg|ion, inv|
|000051e0| 61 6c 52 65 67 69 6f 6e | 29 3b 0d 45 4e 44 3b 20 |alRegion|);.END; |
|000051f0| 7b 56 61 6c 69 64 52 67 | 6e 4f 66 66 73 63 72 65 |{ValidRg|nOffscre|
|00005200| 65 6e 7d 0d 0d 0d 50 52 | 4f 43 45 44 55 52 45 20 |en}...PR|OCEDURE |
|00005210| 49 6e 76 61 6c 52 65 63 | 74 4f 66 66 73 63 72 65 |InvalRec|tOffscre|
|00005220| 65 6e 28 6f 66 66 73 63 | 72 65 65 6e 48 61 6e 64 |en(offsc|reenHand|
|00005230| 6c 65 3a 20 48 61 6e 64 | 6c 65 3b 20 77 69 6e 64 |le: Hand|le; wind|
|00005240| 6f 77 3a 20 57 69 6e 64 | 6f 77 50 74 72 3b 20 69 |ow: Wind|owPtr; i|
|00005250| 6e 76 61 6c 69 64 52 65 | 63 74 3a 20 52 65 63 74 |nvalidRe|ct: Rect|
|00005260| 29 3b 0d 0d 56 41 52 0d | 09 69 6e 76 61 6c 69 64 |);..VAR.|.invalid|
|00005270| 52 67 6e 09 3a 20 52 67 | 6e 48 61 6e 64 6c 65 3b |Rgn.: Rg|nHandle;|
|00005280| 0d 0d 42 45 47 49 4e 0d | 09 69 6e 76 61 6c 69 64 |..BEGIN.|.invalid|
|00005290| 52 67 6e 20 3a 3d 20 4e | 65 77 52 67 6e 3b 0d 09 |Rgn := N|ewRgn;..|
|000052a0| 52 65 63 74 52 67 6e 28 | 69 6e 76 61 6c 69 64 52 |RectRgn(|invalidR|
|000052b0| 67 6e 2c 20 69 6e 76 61 | 6c 69 64 52 65 63 74 29 |gn, inva|lidRect)|
|000052c0| 3b 0d 09 49 6e 76 61 6c | 52 67 6e 4f 66 66 73 63 |;..Inval|RgnOffsc|
|000052d0| 72 65 65 6e 28 6f 66 66 | 73 63 72 65 65 6e 48 61 |reen(off|screenHa|
|000052e0| 6e 64 6c 65 2c 20 77 69 | 6e 64 6f 77 2c 20 69 6e |ndle, wi|ndow, in|
|000052f0| 76 61 6c 69 64 52 67 6e | 29 3b 0d 09 44 69 73 70 |validRgn|);..Disp|
|00005300| 6f 73 65 52 67 6e 28 69 | 6e 76 61 6c 69 64 52 67 |oseRgn(i|nvalidRg|
|00005310| 6e 29 3b 0d 45 4e 44 3b | 20 7b 49 6e 76 61 6c 52 |n);.END;| {InvalR|
|00005320| 65 63 74 4f 66 66 73 63 | 72 65 65 6e 7d 0d 0d 0d |ectOffsc|reen}...|
|00005330| 50 52 4f 43 45 44 55 52 | 45 20 49 6e 76 61 6c 52 |PROCEDUR|E InvalR|
|00005340| 67 6e 4f 66 66 73 63 72 | 65 65 6e 28 6f 66 66 73 |gnOffscr|een(offs|
|00005350| 63 72 65 65 6e 48 61 6e | 64 6c 65 3a 20 48 61 6e |creenHan|dle: Han|
|00005360| 64 6c 65 3b 20 77 69 6e | 64 6f 77 3a 20 57 69 6e |dle; win|dow: Win|
|00005370| 64 6f 77 50 74 72 3b 20 | 69 6e 76 61 6c 69 64 52 |dowPtr; |invalidR|
|00005380| 67 6e 3a 20 52 67 6e 48 | 61 6e 64 6c 65 29 3b 0d |gn: RgnH|andle);.|
|00005390| 0d 56 41 52 0d 09 73 61 | 76 65 64 50 6f 72 74 09 |.VAR..sa|vedPort.|
|000053a0| 3a 20 47 72 61 66 50 74 | 72 3b 0d 09 0d 42 45 47 |: GrafPt|r;...BEG|
|000053b0| 49 4e 0d 09 49 46 20 77 | 69 6e 64 6f 77 20 3c 3e |IN..IF w|indow <>|
|000053c0| 20 4e 49 4c 20 54 48 45 | 4e 20 42 45 47 49 4e 0d | NIL THE|N BEGIN.|
|000053d0| 09 09 47 65 74 50 6f 72 | 74 28 73 61 76 65 64 50 |..GetPor|t(savedP|
|000053e0| 6f 72 74 29 3b 0d 09 09 | 53 65 74 50 6f 72 74 28 |ort);...|SetPort(|
|000053f0| 77 69 6e 64 6f 77 29 3b | 0d 09 09 49 6e 76 61 6c |window);|...Inval|
|00005400| 52 67 6e 28 69 6e 76 61 | 6c 69 64 52 67 6e 29 3b |Rgn(inva|lidRgn);|
|00005410| 0d 09 09 53 65 74 50 6f | 72 74 28 73 61 76 65 64 |...SetPo|rt(saved|
|00005420| 50 6f 72 74 29 3b 0d 09 | 45 4e 44 3b 0d 09 49 46 |Port);..|END;..IF|
|00005430| 20 47 65 74 4d 61 70 28 | 6f 66 66 73 63 72 65 65 | GetMap(|offscree|
|00005440| 6e 48 61 6e 64 6c 65 29 | 20 3c 3e 20 4e 49 4c 20 |nHandle)| <> NIL |
|00005450| 54 48 45 4e 0d 09 09 57 | 49 54 48 20 50 72 69 76 |THEN...W|ITH Priv|
|00005460| 61 74 65 48 61 6e 64 6c | 65 28 6f 66 66 73 63 72 |ateHandl|e(offscr|
|00005470| 65 65 6e 48 61 6e 64 6c | 65 29 5e 5e 20 44 4f 0d |eenHandl|e)^^ DO.|
|00005480| 09 09 09 55 6e 69 6f 6e | 52 67 6e 28 69 6e 76 61 |...Union|Rgn(inva|
|00005490| 6c 52 65 67 69 6f 6e 2c | 20 69 6e 76 61 6c 69 64 |lRegion,| invalid|
|000054a0| 52 67 6e 2c 20 69 6e 76 | 61 6c 52 65 67 69 6f 6e |Rgn, inv|alRegion|
|000054b0| 29 3b 0d 45 4e 44 3b 20 | 7b 56 61 6c 69 64 52 67 |);.END; |{ValidRg|
|000054c0| 6e 4f 66 66 73 63 72 65 | 65 6e 7d 0d 0d 0d 46 55 |nOffscre|en}...FU|
|000054d0| 4e 43 54 49 4f 4e 20 43 | 68 65 63 6b 42 6f 75 6e |NCTION C|heckBoun|
|000054e0| 64 73 4f 66 66 73 63 72 | 65 65 6e 28 6f 66 66 73 |dsOffscr|een(offs|
|000054f0| 63 72 65 65 6e 48 61 6e | 64 6c 65 3a 20 48 61 6e |creenHan|dle: Han|
|00005500| 64 6c 65 3b 20 6e 65 77 | 42 6f 75 6e 64 73 3a 20 |dle; new|Bounds: |
|00005510| 52 65 63 74 3b 0d 09 09 | 09 09 09 20 20 20 56 41 |Rect;...|... VA|
|00005520| 52 20 64 72 61 77 4e 65 | 65 64 65 64 3a 20 42 4f |R drawNe|eded: BO|
|00005530| 4f 4c 45 41 4e 29 3a 20 | 4f 53 45 72 72 3b 0d 0d |OLEAN): |OSErr;..|
|00005540| 56 41 52 0d 09 73 6f 6d | 65 74 68 69 6e 67 43 68 |VAR..som|ethingCh|
|00005550| 61 6e 67 65 64 09 3a 20 | 42 4f 4f 4c 45 41 4e 3b |anged.: |BOOLEAN;|
|00005560| 0d 09 72 69 67 68 74 44 | 65 76 69 63 65 09 09 09 |..rightD|evice...|
|00005570| 3a 20 47 44 48 61 6e 64 | 6c 65 3b 0d 0d 42 45 47 |: GDHand|le;..BEG|
|00005580| 49 4e 20 7b 43 68 65 63 | 6b 42 6f 75 6e 64 73 4f |IN {Chec|kBoundsO|
|00005590| 66 66 73 63 72 65 65 6e | 7d 0d 09 49 46 20 6f 66 |ffscreen|}..IF of|
|000055a0| 66 73 63 72 65 65 6e 48 | 61 6e 64 6c 65 20 3c 3e |fscreenH|andle <>|
|000055b0| 20 4e 49 4c 20 54 48 45 | 4e 0d 09 09 57 49 54 48 | NIL THE|N...WITH|
|000055c0| 20 50 72 69 76 61 74 65 | 48 61 6e 64 6c 65 28 6f | Private|Handle(o|
|000055d0| 66 66 73 63 72 65 65 6e | 48 61 6e 64 6c 65 29 5e |ffscreen|Handle)^|
|000055e0| 5e 20 44 4f 20 42 45 47 | 49 4e 0d 09 09 09 7b 63 |^ DO BEG|IN....{c|
|000055f0| 68 65 63 6b 20 74 6f 20 | 73 65 65 20 69 66 20 74 |heck to |see if t|
|00005600| 68 65 20 73 69 7a 65 20 | 6f 66 20 74 68 65 20 70 |he size |of the p|
|00005610| 6f 72 74 20 63 68 61 6e | 67 65 64 7d 0d 09 09 09 |ort chan|ged}....|
|00005620| 57 49 54 48 20 6e 65 77 | 42 6f 75 6e 64 73 2c 20 |WITH new|Bounds, |
|00005630| 62 69 74 73 50 6f 72 74 | 5e 2e 70 6f 72 74 52 65 |bitsPort|^.portRe|
|00005640| 63 74 2e 62 6f 74 52 69 | 67 68 74 20 44 4f 0d 09 |ct.botRi|ght DO..|
|00005650| 09 09 09 73 6f 6d 65 74 | 68 69 6e 67 43 68 61 6e |...somet|hingChan|
|00005660| 67 65 64 20 3a 3d 20 28 | 72 69 67 68 74 20 2d 20 |ged := (|right - |
|00005670| 6c 65 66 74 20 3c 3e 20 | 68 29 20 7c 20 28 62 6f |left <> |h) | (bo|
|00005680| 74 74 6f 6d 20 2d 20 74 | 6f 70 20 3c 3e 20 76 29 |ttom - t|op <> v)|
|00005690| 3b 0d 0d 09 09 09 49 46 | 20 4e 4f 54 20 73 6f 6d |;.....IF| NOT som|
|000056a0| 65 74 68 69 6e 67 43 68 | 61 6e 67 65 64 20 54 48 |ethingCh|anged TH|
|000056b0| 45 4e 20 42 45 47 49 4e | 0d 09 09 09 09 7b 63 68 |EN BEGIN|.....{ch|
|000056c0| 65 63 6b 20 74 6f 20 73 | 65 65 20 69 66 20 74 68 |eck to s|ee if th|
|000056d0| 65 20 64 65 70 74 68 20 | 6f 66 20 74 68 65 20 73 |e depth |of the s|
|000056e0| 63 72 65 65 6e 20 63 68 | 61 6e 67 65 64 7d 0d 09 |creen ch|anged}..|
|000056f0| 09 09 09 72 69 67 68 74 | 44 65 76 69 63 65 20 3a |...right|Device :|
|00005700| 3d 20 4e 49 4c 3b 0d 09 | 09 09 09 49 46 20 72 65 |= NIL;..|...IF re|
|00005710| 71 75 65 73 74 65 64 44 | 65 70 74 68 20 3d 20 6b |questedD|epth = k|
|00005720| 4d 61 78 44 65 70 74 68 | 20 54 48 45 4e 0d 09 09 |MaxDepth| THEN...|
|00005730| 09 09 09 72 69 67 68 74 | 44 65 76 69 63 65 20 3a |...right|Device :|
|00005740| 3d 20 47 65 74 4d 61 78 | 44 65 76 69 63 65 28 6e |= GetMax|Device(n|
|00005750| 65 77 42 6f 75 6e 64 73 | 29 3b 0d 09 09 09 09 73 |ewBounds|);.....s|
|00005760| 6f 6d 65 74 68 69 6e 67 | 43 68 61 6e 67 65 64 20 |omething|Changed |
|00005770| 3a 3d 20 28 72 69 67 68 | 74 44 65 76 69 63 65 20 |:= (righ|tDevice |
|00005780| 3c 3e 20 4e 49 4c 29 20 | 26 20 28 72 69 67 68 74 |<> NIL) |& (right|
|00005790| 44 65 76 69 63 65 20 3c | 3e 20 62 69 74 73 44 65 |Device <|> bitsDe|
|000057a0| 76 69 63 65 29 3b 0d 09 | 09 09 45 4e 44 3b 0d 0d |vice);..|..END;..|
|000057b0| 09 09 09 49 46 20 73 6f | 6d 65 74 68 69 6e 67 43 |...IF so|methingC|
|000057c0| 68 61 6e 67 65 64 20 54 | 48 45 4e 20 42 45 47 49 |hanged T|HEN BEGI|
|000057d0| 4e 20 7b 77 65 20 68 61 | 76 65 20 61 20 63 6f 6c |N {we ha|ve a col|
|000057e0| 6f 72 20 75 70 64 61 74 | 65 2c 20 48 6f 75 73 74 |or updat|e, Houst|
|000057f0| 6f 6e 7d 0d 09 09 09 09 | 44 65 61 6c 6c 6f 63 61 |on}.....|Dealloca|
|00005800| 74 65 42 69 74 73 28 6f | 66 66 73 63 72 65 65 6e |teBits(o|ffscreen|
|00005810| 48 61 6e 64 6c 65 29 3b | 0d 09 09 09 09 72 65 71 |Handle);|.....req|
|00005820| 75 65 73 74 65 64 42 6f | 75 6e 64 73 20 3a 3d 20 |uestedBo|unds := |
|00005830| 6e 65 77 42 6f 75 6e 64 | 73 3b 0d 09 09 09 45 4e |newBound|s;....EN|
|00005840| 44 3b 0d 09 09 45 4e 44 | 3b 20 7b 57 49 54 48 7d |D;...END|; {WITH}|
|00005850| 0d 09 43 68 65 63 6b 42 | 6f 75 6e 64 73 4f 66 66 |..CheckB|oundsOff|
|00005860| 73 63 72 65 65 6e 20 3a | 3d 20 43 68 65 63 6b 4f |screen :|= CheckO|
|00005870| 66 66 73 63 72 65 65 6e | 28 6f 66 66 73 63 72 65 |ffscreen|(offscre|
|00005880| 65 6e 48 61 6e 64 6c 65 | 2c 20 64 72 61 77 4e 65 |enHandle|, drawNe|
|00005890| 65 64 65 64 29 3b 0d 45 | 4e 44 3b 20 7b 43 68 65 |eded);.E|ND; {Che|
|000058a0| 63 6b 42 6f 75 6e 64 73 | 4f 66 66 73 63 72 65 65 |ckBounds|Offscree|
|000058b0| 6e 7d 0d 0d 0d 0d 50 52 | 4f 43 45 44 55 52 45 20 |n}....PR|OCEDURE |
|000058c0| 42 65 67 69 6e 4f 66 66 | 73 63 72 65 65 6e 44 72 |BeginOff|screenDr|
|000058d0| 61 77 69 6e 67 28 6f 66 | 66 73 63 72 65 65 6e 48 |awing(of|fscreenH|
|000058e0| 61 6e 64 6c 65 3a 20 48 | 61 6e 64 6c 65 3b 20 70 |andle: H|andle; p|
|000058f0| 6f 72 74 3a 20 47 72 61 | 66 50 74 72 29 3b 0d 42 |ort: Gra|fPtr);.B|
|00005900| 45 47 49 4e 20 7b 42 65 | 67 69 6e 4f 66 66 73 63 |EGIN {Be|ginOffsc|
|00005910| 72 65 65 6e 44 72 61 77 | 69 6e 67 7d 0d 09 49 46 |reenDraw|ing}..IF|
|00005920| 20 47 65 74 4d 61 70 28 | 6f 66 66 73 63 72 65 65 | GetMap(|offscree|
|00005930| 6e 48 61 6e 64 6c 65 29 | 20 3c 3e 20 4e 49 4c 20 |nHandle)| <> NIL |
|00005940| 54 48 45 4e 0d 09 7b 6e | 6f 74 65 20 73 69 64 65 |THEN..{n|ote side|
|00005950| 20 65 66 66 65 63 74 20 | 68 65 72 65 20 6f 66 20 | effect |here of |
|00005960| 73 65 74 74 69 6e 67 20 | 75 70 20 6d 61 70 20 66 |setting |up map f|
|00005970| 6f 72 20 64 72 61 77 69 | 6e 67 20 28 73 74 75 66 |or drawi|ng (stuf|
|00005980| 66 69 6e 67 20 62 61 73 | 65 41 64 64 72 29 7d 0d |fing bas|eAddr)}.|
|00005990| 09 09 57 49 54 48 20 50 | 72 69 76 61 74 65 48 61 |..WITH P|rivateHa|
|000059a0| 6e 64 6c 65 28 6f 66 66 | 73 63 72 65 65 6e 48 61 |ndle(off|screenHa|
|000059b0| 6e 64 6c 65 29 5e 5e 20 | 44 4f 20 42 45 47 49 4e |ndle)^^ |DO BEGIN|
|000059c0| 0d 09 09 09 49 46 20 4e | 4f 54 20 6e 6f 74 4f 75 |....IF N|OT notOu|
|000059d0| 72 73 20 54 48 45 4e 20 | 7b 69 66 20 77 65 2c 20 |rs THEN |{if we, |
|000059e0| 6e 6f 74 20 74 68 65 20 | 73 79 73 74 65 6d 2c 20 |not the |system, |
|000059f0| 61 6c 6c 6f 63 61 74 65 | 64 20 74 68 65 20 62 69 |allocate|d the bi|
|00005a00| 74 73 7d 0d 09 09 09 09 | 7b 6c 6f 63 6b 20 74 68 |ts}.....|{lock th|
|00005a10| 65 20 62 69 74 73 20 64 | 6f 77 6e 7d 0d 09 09 09 |e bits d|own}....|
|00005a20| 09 48 4c 6f 63 6b 28 62 | 69 74 73 29 3b 0d 0d 09 |.HLock(b|its);...|
|00005a30| 09 09 7b 77 65 20 6e 65 | 65 64 20 74 68 65 20 70 |..{we ne|ed the p|
|00005a40| 69 78 6d 61 70 20 6c 6f | 63 6b 65 64 20 77 68 69 |ixmap lo|cked whi|
|00005a50| 6c 65 20 77 65 20 61 72 | 65 20 75 73 69 6e 67 20 |le we ar|e using |
|00005a60| 69 74 7d 0d 09 09 09 49 | 46 20 74 68 65 4d 61 63 |it}....I|F theMac|
|00005a70| 2e 68 61 73 43 6f 6c 6f | 72 51 44 20 54 48 45 4e |.hasColo|rQD THEN|
|00005a80| 0d 09 09 09 09 48 4c 6f | 63 6b 28 48 61 6e 64 6c |.....HLo|ck(Handl|
|00005a90| 65 28 62 69 74 73 50 6f | 72 74 5e 2e 70 6f 72 74 |e(bitsPo|rt^.port|
|00005aa0| 50 69 78 4d 61 70 29 29 | 3b 0d 0d 09 09 09 64 72 |PixMap))|;.....dr|
|00005ab0| 61 77 69 6e 67 50 6f 72 | 74 20 3a 3d 20 70 6f 72 |awingPor|t := por|
|00005ac0| 74 3b 0d 09 09 09 47 65 | 74 50 6f 72 74 28 73 61 |t;....Ge|tPort(sa|
|00005ad0| 76 65 64 50 6f 72 74 29 | 3b 0d 09 09 09 0d 09 09 |vedPort)|;.......|
|00005ae0| 09 7b 73 65 74 20 75 70 | 20 74 68 65 20 70 6f 72 |.{set up| the por|
|00005af0| 74 20 61 6e 64 20 74 68 | 65 20 64 65 76 69 63 65 |t and th|e device|
|00005b00| 7d 0d 09 09 09 0d 09 09 | 09 49 46 20 64 72 61 77 |}.......|.IF draw|
|00005b10| 69 6e 67 50 6f 72 74 20 | 3d 20 4e 49 4c 20 54 48 |ingPort |= NIL TH|
|00005b20| 45 4e 0d 09 09 09 09 53 | 65 74 50 6f 72 74 28 47 |EN.....S|etPort(G|
|00005b30| 72 61 66 50 74 72 28 62 | 69 74 73 50 6f 72 74 29 |rafPtr(b|itsPort)|
|00005b40| 29 0d 09 09 09 45 4c 53 | 45 20 42 45 47 49 4e 0d |)....ELS|E BEGIN.|
|00005b50| 09 09 09 09 53 65 74 50 | 6f 72 74 28 64 72 61 77 |....SetP|ort(draw|
|00005b60| 69 6e 67 50 6f 72 74 29 | 3b 0d 09 09 09 09 7b 73 |ingPort)|;.....{s|
|00005b70| 61 76 65 20 74 68 65 20 | 76 69 73 52 67 6e 20 61 |ave the |visRgn a|
|00005b80| 6e 64 20 72 65 70 6c 61 | 63 65 20 69 74 20 77 69 |nd repla|ce it wi|
|00005b90| 74 68 20 6f 75 72 20 70 | 72 69 76 61 74 65 20 6f |th our p|rivate o|
|00005ba0| 6e 65 7d 0d 09 09 09 09 | 73 61 76 65 64 56 69 73 |ne}.....|savedVis|
|00005bb0| 52 67 6e 20 3a 3d 20 64 | 72 61 77 69 6e 67 50 6f |Rgn := d|rawingPo|
|00005bc0| 72 74 5e 2e 76 69 73 52 | 67 6e 3b 0d 09 09 09 09 |rt^.visR|gn;.....|
|00005bd0| 64 72 61 77 69 6e 67 50 | 6f 72 74 5e 2e 76 69 73 |drawingP|ort^.vis|
|00005be0| 52 67 6e 20 3a 3d 20 62 | 69 74 73 50 6f 72 74 5e |Rgn := b|itsPort^|
|00005bf0| 2e 76 69 73 52 67 6e 3b | 0d 09 09 09 09 0d 09 09 |.visRgn;|........|
|00005c00| 09 09 73 61 76 65 64 4d | 61 70 20 3a 3d 20 64 72 |..savedM|ap := dr|
|00005c10| 61 77 69 6e 67 50 6f 72 | 74 5e 2e 70 6f 72 74 42 |awingPor|t^.portB|
|00005c20| 69 74 73 3b 0d 09 09 09 | 09 0d 09 09 09 09 49 46 |its;....|......IF|
|00005c30| 20 74 68 65 4d 61 63 2e | 68 61 73 43 6f 6c 6f 72 | theMac.|hasColor|
|00005c40| 51 44 20 54 48 45 4e 0d | 09 09 09 09 09 53 65 74 |QD THEN.|.....Set|
|00005c50| 50 6f 72 74 50 69 78 28 | 62 69 74 73 50 6f 72 74 |PortPix(|bitsPort|
|00005c60| 5e 2e 70 6f 72 74 50 69 | 78 4d 61 70 29 0d 09 09 |^.portPi|xMap)...|
|00005c70| 09 09 45 4c 53 45 0d 09 | 09 09 09 09 53 65 74 50 |..ELSE..|....SetP|
|00005c80| 6f 72 74 42 69 74 73 28 | 47 72 61 66 50 74 72 28 |ortBits(|GrafPtr(|
|00005c90| 62 69 74 73 50 6f 72 74 | 29 5e 2e 70 6f 72 74 42 |bitsPort|)^.portB|
|00005ca0| 69 74 73 29 3b 0d 09 09 | 09 45 4e 44 3b 20 7b 66 |its);...|.END; {f|
|00005cb0| 6f 72 20 63 61 6c 6c 65 | 72 2d 73 75 70 70 6c 69 |or calle|r-suppli|
|00005cc0| 65 64 20 70 6f 72 74 20 | 63 61 73 65 7d 0d 09 09 |ed port |case}...|
|00005cd0| 09 0d 09 09 09 49 46 20 | 74 68 65 4d 61 63 2e 68 |.....IF |theMac.h|
|00005ce0| 61 73 43 6f 6c 6f 72 51 | 44 20 54 48 45 4e 20 42 |asColorQ|D THEN B|
|00005cf0| 45 47 49 4e 0d 09 09 09 | 09 73 61 76 65 64 44 65 |EGIN....|.savedDe|
|00005d00| 76 69 63 65 20 3a 3d 20 | 47 65 74 47 44 65 76 69 |vice := |GetGDevi|
|00005d10| 63 65 3b 0d 09 09 09 09 | 53 65 74 47 44 65 76 69 |ce;.....|SetGDevi|
|00005d20| 63 65 28 62 69 74 73 44 | 65 76 69 63 65 29 3b 0d |ce(bitsD|evice);.|
|00005d30| 09 09 09 45 4e 44 3b 20 | 7b 49 46 20 74 68 65 4d |...END; |{IF theM|
|00005d40| 61 63 2e 68 61 73 43 6f | 6c 6f 72 51 44 7d 0d 09 |ac.hasCo|lorQD}..|
|00005d50| 09 09 0d 09 09 09 57 49 | 54 48 20 74 68 65 50 6f |......WI|TH thePo|
|00005d60| 72 74 5e 20 44 4f 0d 09 | 09 09 09 7b 69 6e 74 65 |rt^ DO..|...{inte|
|00005d70| 72 73 65 63 74 20 74 68 | 65 20 69 6e 76 61 6c 69 |rsect th|e invali|
|00005d80| 64 61 74 65 64 20 6f 66 | 66 73 63 72 65 65 6e 20 |dated of|fscreen |
|00005d90| 72 65 67 69 6f 6e 20 77 | 69 74 68 20 70 72 69 76 |region w|ith priv|
|00005da0| 61 74 65 20 76 69 73 52 | 67 6e 7d 0d 09 09 09 09 |ate visR|gn}.....|
|00005db0| 53 65 63 74 52 67 6e 28 | 69 6e 76 61 6c 52 65 67 |SectRgn(|invalReg|
|00005dc0| 69 6f 6e 2c 20 76 69 73 | 52 67 6e 2c 20 76 69 73 |ion, vis|Rgn, vis|
|00005dd0| 52 67 6e 29 3b 0d 09 09 | 45 4e 44 3b 20 7b 57 49 |Rgn);...|END; {WI|
|00005de0| 54 48 7d 0d 45 4e 44 3b | 20 7b 42 65 67 69 6e 4f |TH}.END;| {BeginO|
|00005df0| 66 66 73 63 72 65 65 6e | 44 72 61 77 69 6e 67 7d |ffscreen|Drawing}|
|00005e00| 0d 0d 0d 0d 50 52 4f 43 | 45 44 55 52 45 20 45 6e |....PROC|EDURE En|
|00005e10| 64 4f 66 66 73 63 72 65 | 65 6e 44 72 61 77 69 6e |dOffscre|enDrawin|
|00005e20| 67 28 6f 66 66 73 63 72 | 65 65 6e 48 61 6e 64 6c |g(offscr|eenHandl|
|00005e30| 65 3a 20 48 61 6e 64 6c | 65 29 3b 0d 0d 54 59 50 |e: Handl|e);..TYP|
|00005e40| 45 0d 09 50 4d 61 70 48 | 61 6e 64 6c 65 50 74 72 |E..PMapH|andlePtr|
|00005e50| 09 3d 20 5e 50 69 78 4d | 61 70 48 61 6e 64 6c 65 |.= ^PixM|apHandle|
|00005e60| 3b 0d 09 0d 42 45 47 49 | 4e 20 7b 45 6e 64 4f 66 |;...BEGI|N {EndOf|
|00005e70| 66 73 63 72 65 65 6e 44 | 72 61 77 69 6e 67 7d 0d |fscreenD|rawing}.|
|00005e80| 09 49 46 20 47 65 74 4d | 61 70 28 6f 66 66 73 63 |.IF GetM|ap(offsc|
|00005e90| 72 65 65 6e 48 61 6e 64 | 6c 65 29 20 3c 3e 20 4e |reenHand|le) <> N|
|00005ea0| 49 4c 20 54 48 45 4e 0d | 09 09 57 49 54 48 20 50 |IL THEN.|..WITH P|
|00005eb0| 72 69 76 61 74 65 48 61 | 6e 64 6c 65 28 6f 66 66 |rivateHa|ndle(off|
|00005ec0| 73 63 72 65 65 6e 48 61 | 6e 64 6c 65 29 5e 5e 20 |screenHa|ndle)^^ |
|00005ed0| 44 4f 20 42 45 47 49 4e | 0d 09 09 09 7b 72 65 73 |DO BEGIN|....{res|
|00005ee0| 74 6f 72 65 20 74 68 65 | 20 6d 61 70 2c 20 64 65 |tore the| map, de|
|00005ef0| 76 69 63 65 2c 20 70 6f | 72 74 7d 0d 09 09 09 0d |vice, po|rt}.....|
|00005f00| 09 09 09 49 46 20 64 72 | 61 77 69 6e 67 50 6f 72 |...IF dr|awingPor|
|00005f10| 74 20 3c 3e 20 4e 49 4c | 20 54 48 45 4e 20 42 45 |t <> NIL| THEN BE|
|00005f20| 47 49 4e 0d 09 09 09 09 | 53 65 74 50 6f 72 74 28 |GIN.....|SetPort(|
|00005f30| 64 72 61 77 69 6e 67 50 | 6f 72 74 29 3b 0d 09 09 |drawingP|ort);...|
|00005f40| 09 09 64 72 61 77 69 6e | 67 50 6f 72 74 5e 2e 76 |..drawin|gPort^.v|
|00005f50| 69 73 52 67 6e 20 3a 3d | 20 73 61 76 65 64 56 69 |isRgn :=| savedVi|
|00005f60| 73 52 67 6e 3b 20 7b 72 | 65 73 74 6f 72 65 20 6f |sRgn; {r|estore o|
|00005f70| 72 69 67 69 6e 61 6c 20 | 76 69 73 52 67 6e 7d 0d |riginal |visRgn}.|
|00005f80| 09 09 09 09 0d 09 09 09 | 09 49 46 20 74 68 65 4d |........|.IF theM|
|00005f90| 61 63 2e 68 61 73 43 6f | 6c 6f 72 51 44 20 54 48 |ac.hasCo|lorQD TH|
|00005fa0| 45 4e 0d 09 09 09 09 09 | 53 65 74 50 6f 72 74 50 |EN......|SetPortP|
|00005fb0| 69 78 28 50 4d 61 70 48 | 61 6e 64 6c 65 50 74 72 |ix(PMapH|andlePtr|
|00005fc0| 28 40 73 61 76 65 64 4d | 61 70 29 5e 29 0d 09 09 |(@savedM|ap)^)...|
|00005fd0| 09 09 45 4c 53 45 0d 09 | 09 09 09 09 53 65 74 50 |..ELSE..|....SetP|
|00005fe0| 6f 72 74 42 69 74 73 28 | 73 61 76 65 64 4d 61 70 |ortBits(|savedMap|
|00005ff0| 29 3b 0d 09 09 09 45 4e | 44 3b 20 7b 66 6f 72 20 |);....EN|D; {for |
|00006000| 63 61 6c 6c 65 72 2d 73 | 75 70 70 6c 69 65 64 20 |caller-s|upplied |
|00006010| 70 6f 72 74 20 63 61 73 | 65 7d 09 09 09 09 0d 09 |port cas|e}......|
|00006020| 09 09 09 0d 09 09 09 49 | 46 20 74 68 65 4d 61 63 |.......I|F theMac|
|00006030| 2e 68 61 73 43 6f 6c 6f | 72 51 44 20 54 48 45 4e |.hasColo|rQD THEN|
|00006040| 0d 09 09 09 09 53 65 74 | 47 44 65 76 69 63 65 28 |.....Set|GDevice(|
|00006050| 73 61 76 65 64 44 65 76 | 69 63 65 29 3b 0d 09 09 |savedDev|ice);...|
|00006060| 09 09 0d 09 09 09 53 65 | 74 50 6f 72 74 28 73 61 |......Se|tPort(sa|
|00006070| 76 65 64 50 6f 72 74 29 | 3b 0d 0d 09 09 09 7b 77 |vedPort)|;.....{w|
|00006080| 65 20 6f 6e 6c 79 20 6e | 65 65 64 20 74 68 65 20 |e only n|eed the |
|00006090| 70 69 78 6d 61 70 20 6c | 6f 63 6b 65 64 20 77 68 |pixmap l|ocked wh|
|000060a0| 69 6c 65 20 77 65 20 61 | 72 65 20 75 73 69 6e 67 |ile we a|re using|
|000060b0| 20 69 74 7d 0d 09 09 09 | 49 46 20 74 68 65 4d 61 | it}....|IF theMa|
|000060c0| 63 2e 68 61 73 43 6f 6c | 6f 72 51 44 20 54 48 45 |c.hasCol|orQD THE|
|000060d0| 4e 0d 09 09 09 09 48 55 | 6e 6c 6f 63 6b 28 48 61 |N.....HU|nlock(Ha|
|000060e0| 6e 64 6c 65 28 62 69 74 | 73 50 6f 72 74 5e 2e 70 |ndle(bit|sPort^.p|
|000060f0| 6f 72 74 50 69 78 4d 61 | 70 29 29 3b 0d 0d 09 09 |ortPixMa|p));....|
|00006100| 09 49 46 20 4e 4f 54 20 | 6e 6f 74 4f 75 72 73 20 |.IF NOT |notOurs |
|00006110| 54 48 45 4e 0d 09 09 09 | 09 7b 75 6e 6c 6f 63 6b |THEN....|.{unlock|
|00006120| 20 74 68 65 20 62 69 74 | 73 20 73 6f 20 74 68 65 | the bit|s so the|
|00006130| 79 20 63 61 6e 20 66 6c | 6f 61 74 7d 0d 09 09 09 |y can fl|oat}....|
|00006140| 09 48 55 6e 6c 6f 63 6b | 28 62 69 74 73 29 3b 0d |.HUnlock|(bits);.|
|00006150| 09 09 09 0d 09 09 09 57 | 49 54 48 20 62 69 74 73 |.......W|ITH bits|
|00006160| 50 6f 72 74 5e 20 44 4f | 0d 09 09 09 09 52 65 63 |Port^ DO|.....Rec|
|00006170| 74 52 67 6e 28 76 69 73 | 52 67 6e 2c 20 70 6f 72 |tRgn(vis|Rgn, por|
|00006180| 74 52 65 63 74 29 3b 20 | 7b 73 65 74 20 70 72 69 |tRect); |{set pri|
|00006190| 76 61 74 65 20 76 69 73 | 52 67 6e 20 62 61 63 6b |vate vis|Rgn back|
|000061a0| 20 74 6f 20 66 75 6c 6c | 20 73 69 7a 65 7d 0d 09 | to full| size}..|
|000061b0| 09 45 4e 44 3b 20 7b 57 | 49 54 48 7d 0d 45 4e 44 |.END; {W|ITH}.END|
|000061c0| 3b 20 7b 45 6e 64 4f 66 | 66 73 63 72 65 65 6e 44 |; {EndOf|fscreenD|
|000061d0| 72 61 77 69 6e 67 7d 0d | 0d 0d 50 52 4f 43 45 44 |rawing}.|..PROCED|
|000061e0| 55 52 45 20 42 65 67 69 | 6e 55 70 64 61 74 65 4f |URE Begi|nUpdateO|
|000061f0| 66 66 73 63 72 65 65 6e | 28 6f 66 66 73 63 72 65 |ffscreen|(offscre|
|00006200| 65 6e 48 61 6e 64 6c 65 | 3a 20 48 61 6e 64 6c 65 |enHandle|: Handle|
|00006210| 3b 20 77 69 6e 64 6f 77 | 3a 20 57 69 6e 64 6f 77 |; window|: Window|
|00006220| 50 74 72 29 3b 0d 42 45 | 47 49 4e 0d 09 42 65 67 |Ptr);.BE|GIN..Beg|
|00006230| 69 6e 55 70 64 61 74 65 | 28 77 69 6e 64 6f 77 29 |inUpdate|(window)|
|00006240| 3b 0d 09 49 46 20 47 65 | 74 4d 61 70 28 6f 66 66 |;..IF Ge|tMap(off|
|00006250| 73 63 72 65 65 6e 48 61 | 6e 64 6c 65 29 20 3c 3e |screenHa|ndle) <>|
|00006260| 20 4e 49 4c 20 54 48 45 | 4e 20 42 45 47 49 4e 0d | NIL THE|N BEGIN.|
|00006270| 09 09 42 65 67 69 6e 4f | 66 66 73 63 72 65 65 6e |..BeginO|ffscreen|
|00006280| 44 72 61 77 69 6e 67 28 | 6f 66 66 73 63 72 65 65 |Drawing(|offscree|
|00006290| 6e 48 61 6e 64 6c 65 2c | 20 77 69 6e 64 6f 77 29 |nHandle,| window)|
|000062a0| 3b 20 7b d5 73 65 63 74 | 73 20 69 6e 76 61 6c 52 |; {.sect|s invalR|
|000062b0| 65 67 69 6f 6e 20 77 69 | 74 68 20 76 69 73 52 67 |egion wi|th visRg|
|000062c0| 6e 7d 0d 09 09 7b 76 61 | 6c 69 64 61 74 65 20 74 |n}...{va|lidate t|
|000062d0| 68 65 20 65 6e 74 69 72 | 65 20 63 6f 6e 74 65 6e |he entir|e conten|
|000062e0| 74 73 20 6f 66 20 74 68 | 65 20 6f 66 66 73 63 72 |ts of th|e offscr|
|000062f0| 65 65 6e 20 62 75 66 66 | 65 72 7d 0d 09 09 56 61 |een buff|er}...Va|
|00006300| 6c 69 64 52 65 63 74 4f | 66 66 73 63 72 65 65 6e |lidRectO|ffscreen|
|00006310| 28 6f 66 66 73 63 72 65 | 65 6e 48 61 6e 64 6c 65 |(offscre|enHandle|
|00006320| 2c 20 4e 49 4c 2c 20 50 | 72 69 76 61 74 65 48 61 |, NIL, P|rivateHa|
|00006330| 6e 64 6c 65 28 6f 66 66 | 73 63 72 65 65 6e 48 61 |ndle(off|screenHa|
|00006340| 6e 64 6c 65 29 5e 5e 2e | 62 69 74 73 50 6f 72 74 |ndle)^^.|bitsPort|
|00006350| 5e 2e 70 6f 72 74 52 65 | 63 74 29 3b 0d 09 45 4e |^.portRe|ct);..EN|
|00006360| 44 3b 0d 45 4e 44 3b 20 | 7b 42 65 67 69 6e 55 70 |D;.END; |{BeginUp|
|00006370| 64 61 74 65 4f 66 66 73 | 63 72 65 65 6e 7d 0d 0d |dateOffs|creen}..|
|00006380| 0d 50 52 4f 43 45 44 55 | 52 45 20 45 6e 64 55 70 |.PROCEDU|RE EndUp|
|00006390| 64 61 74 65 4f 66 66 73 | 63 72 65 65 6e 28 6f 66 |dateOffs|creen(of|
|000063a0| 66 73 63 72 65 65 6e 48 | 61 6e 64 6c 65 3a 20 48 |fscreenH|andle: H|
|000063b0| 61 6e 64 6c 65 3b 20 77 | 69 6e 64 6f 77 3a 20 57 |andle; w|indow: W|
|000063c0| 69 6e 64 6f 77 50 74 72 | 29 3b 0d 42 45 47 49 4e |indowPtr|);.BEGIN|
|000063d0| 0d 09 49 46 20 47 65 74 | 4d 61 70 28 6f 66 66 73 |..IF Get|Map(offs|
|000063e0| 63 72 65 65 6e 48 61 6e | 64 6c 65 29 20 3c 3e 20 |creenHan|dle) <> |
|000063f0| 4e 49 4c 20 54 48 45 4e | 20 42 45 47 49 4e 0d 09 |NIL THEN| BEGIN..|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.